Skip to main content

Full text of "Micro 6502 Journal Issue 17"

See other formats


* /^ NOWPRESBNTINa.. ^^ 






Apple' software 

\ ior yout Entertainment * Bttsiness - Educ ation 

Star Attraalons: 



FILEMASTER 2 programs: FORMAT & RETRIEVAL comprise 
a powerful data file manager. Great for everything from phone lists 
to legal abstracts. Needs 32K. Design your own data structure. Up 
to 500 characters per record. Up to 15 searchable fields in any com- 
bination. On Disk $34.95 

SPACE Multi-faceted simulation of life in interstellar society. You 
and opponents must make life 8t death decisions. Keeps track of 
your progress from one game to next. Needs 48K and Applesoft 

ROM. Disk $29.95 

Pot O'Gold I or our All New Pot 0' Gold II A collection of 49 pro- 
grams for 16K Apple. Everything from Logic to action games. Only 
a buck a game. Specify I or II. Price each: Tape $49 .... Disk $54 

ADVENTURE Fight off pirates and vicious dwarfs. 700 travel op- 
tions, 140 locations, 64 objects. Needs ROM & 48K. Disk. . $29.95 

16K CASSETTE INVENTORY Use item number, description, 
stock amount, reorder amount, restock date, cost & sell price. Holds 
up to 140 items. Tape $35 

32K DISK INVENTORY: Use stock numbers description, vendor, 
record of purchase and sales date, amount on hand, cost & sell price, 

total value. Holds up to 300 items. Disk $40 

With Parts Explosion: Disk $50 

32K DATA BASE Cross file for phone lists, bibliographies, recipes. 
Run up to 9 lines of 40 columns each. Search by item anywhere. 
Disk. $20 

24K HI-RES LIFE SIMULATION Conway's equations on 296x180 
screen. A mathematical simulation to demo population growth with 
birth, death and survival as factors. Tape $10 

16K CIRCUIT LOGIC DEVELOPMENT AID Evaluate circuits of 
up to 255 gates, including AND, OR, NOR, NAND, XOR, XNOR 
and INVERTER. Tape $10 

18K MORSE CODE TRAINER Learn Morse Code, and transmit or 
receive over radio. Tape $10 

18K DEVIL'S DUNGEON: Adventure through dark passages where 
monsters, demons, poisonous gas, dropoffs threaten ... all to disco- 
ver fantastic treasures. Comes with instruction book. Tape ... $10 

16K PACIFICA: Discover the floating island and rescue the beauti- 
ful princess. To win you must recover the enchanted crown, but you 
facethethreat of magic spells and demons. Tape $9.95 

Don't see what you've been looking for, here? 
Then write for our FREE SOFTWARE CATALOG. 
We're saving one just for you! 

To order software, add $2 shipping. To transfer tape ver- 
sions to disk add $5. California residents add 6% sales tax. 
Sorry, we can not ship to P. 0. Boxes. VISA/MASTERCHARGE 
Welcomed! 



RAINBOW'S CASINO 9 gambling games: Roulette, Blackjack, 
Craps, Horserace, and a few originals that Vegas hasn't heard about. 
Needs 16K. Tape $29.95 

16K SPACE WAR: You in your space capsule battle against the 
computer's saucer . .. in hi-res graphics. Tape $12 

16K MEMORY VERIFY Diagnostic routine to check range of mem- 
ory. Indicates faulty addresses, data in memory cell, and faulty data. 
Tape $5 

16K APPLEODION Music synthesis composes original Irish jigs. 
Enter your own music and save on tape or disk. Includes 3 Bach 
fugues. Tape $10 

16K APPLEVISION Demo for Hi-Res graphics and music. 

Tape $10 

32K COMPU-READ 5 programs to teach you speed reading, in 
stages. Includes synonym and antonym identification. You control 
your rate of speed, or keep up with the computer's pace. 
Disk $24.95 

48K PERCEPTION I, II, III random shapes and sizes must be 
matched. In III, you control format and display time and get 
weighted scores. Needs ROM. Each Disk $24.95 

32K STORY TELLER Use your bizarre imagination and input key 
words for fantastic and funny tales. Never the same story twice. 
Tape $12.95 

32K WAR/RESCUE Engage in 10 battles with your infantry against 
the Apple robots. Calculate Apple's strategy and win more battles 
than the computer. Tape $12.95 

24K POLAR PLOT Plot polar equations in Hi-Res Graphics. 

Tape $10 

32K SHAPE SCALER Utility to generate and animate Hi-Res 
graphic shapes. Simple routine provided to inspect position of 
shapes, and specify precise X/Y coordinates and scale. Needs ROM. 
Disk $13.95 

32K ZINTAR/PROPHET Great party game. Under control of the 
mighty Zintar's edict you take a very special trip to the world of 
Krintar. Heightened visual graphics. Needs ROM. Disk .... $16.95 

APPLE MONITOR PEELED Everything you wanted to know about 
the Apple Monitor but couldn't figure out. User-written manual in 
plain English clears your confusion. Only $9.95 




Garden Plaza Shopping Center, Dept. 1 1 A 

9719 Reseda Blvd., Northridge, Ca 91324 

Telephone: (213) 349-5560 



sum THIS Pf^cai^fifii 

IE liiar data 11 f Cm flalcii 
3C [lEtc nailf^cfv 
3[] [Tlail fern 
tic Raaaiiia ilia f arscial 
acmpLiarSaialcg i 

SB Eld ■ 

Hall [Icia? 

Follow this simple program and you will receiie 
The Personal Computer Catalog. The one refer- 
ence book to fine quality personal computes, 
software, supplies and accessories. 

This valuable catalog is FREE so mail your oi^er 
today. 




Address. 
City 



Do you own a computer?. 



.What type? 



Do you use your computer for: 
Personal? Education? 



Business?. 
-Other? 



Mail this form to: 



.OT^I P 5TJ 




SERVING THE PERSONAL 
Or phone: (612) 884-1475 



UTER INDUSTRY 

Weldon Electronics 
4150 Hillcrest Road 
Wayzata, MN 55391 



The Basic Switcti 

Attention "Old" Pet"** Owners: 

Not sure about the ROM Retrofit Kit from Comnm )dore? 

Now you can use botti sets of Commodore RON Is and others as well. 

Ttie Basic Switcti allows switch selection of etttier ROM set (your original set or 
your retrofit set) from Commodore, Plus, Model 1 5-A includes an additional zero 
insertion force socket allowing easy use of ROM > like the BASIC Programmer's Toolkit 
... concurrently 

Model 14-E The economy model of Ttie Basic Switcti. Stand alone board and 
harness without case and case he irdware. The free standing unit is 
ready to accept your ROMs. 

Model 14-D Same as Model 14-E but includes attractive protective case and 
mounted Basic Switcti board. 

Note that Model 14 Series does not allow for exp ansion ROMs like the BASIC Pro- 
grammer's Toolkit. 

Model 15-A Ttie Basic Switcti plus ... includes 'Expanded cable assembly and 
zero insertion force socket. Your If th ROM simply plugs in ... enabled 
while either ROM set is selected. S Dcket 15 may be readdressed by 
the user for additional flexibility. 

Ttie Basic Switcti is sold in assembled form only All models are designed for easy 
attachment to your Pet with a convenient cabk > assembly No soldering or drilling 
is required. Ttie Basic Switcti mates with a cable assembly at your primary board, 
and does not use the physical connectors of ar / Pet ports. 

Model 15-A allows you to use the BASIC Prograrr mer's Toolkit without the need for 
the additional $25.00 board or tying up your pc f ts. And since we've designed 
the 15th socket to be readdressable, watch for r lore ROM pacs later in the Fall. 

Ttie Basic Switcti: With instaile* i ROM With BASIC 

Retrofit Kit frc >m Programmer's Toolkit * 

Commodore : 

Mode[14-E S64.95 S149.95 

Moden4-D S77.95 $162.95 

Model 15-A $99.95 $184.95 $149.95 

Model 15-A with installed ROM Retrofit and Basic Programmer's Toolkit: $229.95 

Model 15-A with installed ROM Retrofit and both Toolkits: $274.95 

"Old" Pets were shipped with 24 or 28 pin ROMs. ^ bu must check which you have, 
and specify at time of order. 

Small System Services, Inc. 
Ttie Basic Switcti^^ is a product of 900 Sprin g Garden Street 

Greensbo o. North Carolina 27403 
Telephone 919-272-4867 

Pet™ is a trademark of Commodore Business Mc chines. Inc. of Santa Clara, Calif. 
The BASIC Programmer's Toolkit is a product of P i\o Alto IC's, A Division of Nestor 

Systems, Inc. i^Q^th Cardina residents add 4% sales tax. All ord' srs add S2.50 shipping. 



^ 




■ 




\. 






/^ 




^^^^_^^^^ 




X 


^iM^ 


;iml 






\ 


<J^i^^JS^ 


^^>^ 

^ 


\\ 










^^^^^■^^^^M 


9 








^^ 


Table of Contents 






October 1979 


Nrcer Writer 




5 




rssue Number 17 


bv Fii'-i> i^imcil. 










Disassembling the DOS 3 2 

by .Villi nil Hr.n iM- 

HoofciiigPETtoMdBell 

C. 1 '- -1 ■!. 




7 
•1 










Speiunker 

by Th. > I' F1 V ri-lit. ti 




5 




Staff 


6522 Timing and Counting Tecliniques 

by Mj'.t L Uc J ,ii». 




7 






Carer Shuffling Program for KIM-1 




.1 






by hi i'l" ' li 111 








Editor/Publisher 


How Do You Connect Peripherals to Your Superboard II 


•3 




Robert M Tripp 


by F-mt H 'f 








Assistant Editor 


The MICRO Software Catalog: Xltl 

by Mikf t:oA6 




• 9 




Mary Ann Curtis 


Hypocycloids 

by = n M,i'i. 




:2 




Business RAanager 

Magqic E. Fisher 


SYM-1 6S32 Programmable Timer 

by F- ..r- A F%. k 




£5 




Circulation IManager 

Carol Ann Steirh 


Letters 




£S 




Production Assistant 

L Catherine Bfarrd 


A Real Time Clock for OSI Disk Systems 

by "i-i T* 1 Kh't.' 

6502 B ibhography- Part XII 1 

by t'l W'liia.n P ri.jl 




6t 




Comptroller 

Donna M Tripp 




Advertiser's 


index 




AB 1 ■ nil utfi.s 


Sit 


P-nqi "Siivo So(t*arp 


48 


Betafi'iripiilHf D(",i i-s 


42 


Pvqm Pioqrdmminq 


to 


ConionlH CoripoP' nts 


3^3J 


Hamb 3vii Computing 


nc IFC 


TheCi'n piit-rst Int 


25 


Seaw -IL Itrarheting 


cc 


Coirifi-'l'''' "^hijp 


47 


SKYL.SEfectionicVUorki. 'i152BC 


Conr—i '1. Jl iniciiiCoiTiciHoi-j 


54 


&ni;iil Systems Services, tnc 2 


Elecfi ni. e.recMlii.t'. I-il 


57 


&>rtoi ich, Inc 


58 


H. G"llf I '.'.mpiitHr Sv.ii^ni- 


13 


SofisiJe SoftAare 


IBC 


Hud'>>n Diqital Ei<-i.tri<nic> 


40 


Svnpr iCtics 


56 


Mici- reunnoiogy Uiiiirnit <d 


26 


Syner gistic Suf'uaip. 


SS 


MU&c toftw.iie 


4 


rextp. St 


57 


Pow«T"soti Im 


?0 


Weldcn Electronics 


t 


Progr iiiini'i limerndtiundi 


t4 


Wi/bt Side Electronics 


58 


-. 








J 



itca"3"(^[=i^i 



>: 



UPER 

TEXT* 



<fi -^ 






m 



'W, 



SUPER-TEXT is a professional word processing system for the Apple II and Apple II Plus computers. 

SUPER-TEXT is the most innovative word processor available on any personal microcomputer and includes 

features previously found only on word processing systems costing thousands more ! 

An advanced multiple paging system allows you to view two text screens simultaneously. You may keep notes 

or instructions on one text screen while you edit on the other. 

SUPER-TEXT is a character oriented editor with complete cursor controls to easily move the cursor to any position 

in the text with a minimum of keystrokes. 

Built in floating point math and automatic tabbing facilitate the preparation of all manual reports including Mnancial 

reports, insurance forms, real estate settlements and more. 

SUPER-TEXT is easier to operate than a typewriter yet challenges the flexibility of pencil and paper. 



SELECTED FEATURES: 

EDITING - Full floating cursor. Cursor control - left, 
right, up, down or to center of screen. Add or insert 
a character, word or line. Automatic carriage return 
eliminates a word breaking at the end of the screen 
line. Delete a character, word, line or screen. Automatic 
on screen tabbing and right or left justification of 
columns Unlimited text movement. Scroll either a page 
or a line forward or back, fvlove to the beginning or end 
of the text or screen. Move to the last change made 
in the text. N/love to a block marker. Global search and 
replace (selective or all). Block operations - copy, delete 
or save to disk. Select multiple or single screen mode. 
ADVANCED FILE HANDLING - Requires only two 
keystrokes to load or save a file to disk. The file name 
does not have to be entered which eliminates misspelling 



and "FILE NOT FOUND" errors. Save entire text 
or portion of to disk. Complete file merging capabilities. 
MATH - Automatic column totals. Formula computations. 
User selectable number of decimal positions. 
Automatically switches to scientific notation when 
necessary. 1 4 significant digits. 
PRINT CONTROLS - Upper and lower case printing 
without acditional hardware. Automatic paragraph 
indentation. Single ordouble space printing. Selectable 
right justification of text. Variable page length and width. 
Automatic page numbering. Selectable chapter-relative 
page numoering. Automatic print tabbing. Right or left 
justificatic-n of columnar data. Single sheet or continous 
form printing. Superscripting and subscripting 
Undersco'ing. Line centering. Automatic link and printing 
of multiple text files. (48k) 99.95 



MICRO INFORMATION SYSTEM"" (48k| $99 95 is a breakthrough in etlective in- 
lorma'ion systems ot any size This one system handles accounts payable/receivable, 
inventories, appointment calendars, cost estimating, real estate listings, sales solicita- 
I'ons. manpower accounting, selective mailings and label printing, dietary informa- 
lion phone directories and more! On diskette 

U-DRAW 11"" |32k| $39.95. a complete graphics package lor the Apple II with disk 
You can create a figure and rotate, expand, contract or move it anywhere on your 
video screen with a lew simple keystrokes. Save individual figures or complete draw- 
ings on disk and recall them later. U-DRAW It automatically builds and edits multi- 
figure shape tables that are directly transferable to your BASIC programs You won't 
t.nd better graphics capabilities at 100 times the price! 

APPILOT EDU-DISK™ (32k) $49.95 A complete multi-program C A I. system for the 
APPLE II Includes program editor and APPILOT interpretor on diskette with exten- 
sive on-line HELP lessons plus documentation manual 

THREE MILE ISLAND"^ (48k) $39 95 Is the technology ol a nuclear reactor loo 
f-omplex :o Handle' Now you have the opportunity to decide for yourself, with 
T)-iREE WIL.£ ISLAND a realistic simulation ol a pressurized nuclear reactor Four 
spectacular displays n^onttor the containment building, turbines, titters, condenser, 
redclor care and thi; pump house Valves, pumps, turbines, filters and control rods 
an; ndividually activated by keyboard command. The comprehensive documentation 
describes ir- deiail 'he operating mechanisms and component interactions 



SUPER-LOAD CASSETTES 

U-DRAW(16k)$1795 

ELECTRIC CRAYON (8k) $17 95 

MAZEGAME(8k)S12.95 

ESCAPE (16k) $12.95 

SIDE SHOWS (8k) 12.95 

TANK WAR (16k) $12.95 

MUSIC BOX (8k)$12.95 

BASEBALL(16k)- $14 95 

UNCLE SAMS JIGSAW (32k)- $12 95 

GLOBAL WAR (32k)- $1 7 95 

-Plus APPLESOf^T Boaro 



MUSE 

THE LEADER IN QUALITY SOFTWARE 



Available from dealers or write today to the 
MUSE CO., 7112 Darlington Drive, Baltimore, MD 21234 _____ 
Order by phone (301) 661-8531 MASTERCHARGE and VISA welcome 



v/sr 



Nicer Writer 



Is screen wraparound a necessary fact of life? Or can 
the computer adapt to conventional line ending rules? 
This little BASIC output routine goes a long way toward 
eliminating wraparound once and for all. 



Rick Connolly 

41 Roland Drive 

Bullwin, MO 63011 



Has this ever happened to you: A 
group of friends are admiring your ex- 
pensive investment. With the flair of a 
true computer expert, you press the ap- 
propriate buttons, push RETURN, and 
teli the expectant guests to watch the 
screen. "Hi!", the computer prints. 
"Thanks for answering the questions as 
well as you did. Rick. I can state that you 
should live 55.215677 more years and 
have 2.15662 children." 

You wait for the applause. Instead, 
you hear, "How come the words run off 
the end of the line?" Dead silence. You 
are embarrassed— for your guests, of 
course. Instead of seeing the brilliant 






REM 


NICER WRITER 


5 


REM 




10 


REM 


PROGRAM DEVELOPED 


20 


REM 


AND COPYRIGHT (C) 1979 


30 


REM 
JR 


BY M.R. "RICK" CONNOLLY 


40 


REM 


5009 RICKWOCD CT NW 


45 


REM 


: HUNTSVILLE, AL 35310 


46 


REM 




49 


REM 




50 


REM 


N$ IS THE STRING TO BE 




PRINTED 


60 


REM 


CW IS THE COLUMN WIDTH 




OF 


THE PRINTER OR MONITOR 


70 


REM 


Ml IS THE TAB INDENTATION 




0^ 


1 THE FIRST LINE 


30 


REM 


M2 IS THE TAB INDENTATION 




ON 


SUBSEQUENT LINES (TAB 1 




IS 


INDENTATION ON THE AP- 




PLE) 


90 


REM 


M3 IS THE NUMBER OF CHAR- 




ACTERS PER LINE TO BE DIS- 




PLAYED 


91 


REM 





output of your sophisticated piogram, 
your guests saw: 



HI! THANKS FOR ANSWERING THE QUESTIONS A 
S WELL AS YOU DID, RICK. I CAN S ATE THA 
T YOU SHOULD LIVE 55.215677 MORE YEARS A 
ND HAVE 2.15662 CHILDREN. 



Now, you and i know that screen 
wraparound Is a fact of life. Perhaps the 
program concatinated a bit. Or, 
possibly, it was adapted from ar article 
written by some thoughtless auti or with 
a 64 column screen or an 80 column 
printer. In either case, you probably will 
soon tire of explaining that nothing is 



100 N$ = "THIS IS AN EXAMPLE OF A 
LONG SENTENCE THAT COULD CO 
ME EITHER FROM A PROGRW WRI 
TTEN FOR A 64 OR 30 COLUMN S 
CBEEN OR PRINTER, OR FROM ON 
E THAT CONCATINATES . 5UPERC 
ALIFRAGALISTICEXPIALIDXIOUS 
, NO?" 

110 Ml = 5:M2 = 1:M3 = 40:CW = 40 

120 HOME : PRINT "PRINTOUT DF ST 
RING N$ AS IT WOULD NOR- MA 
LLY BE PRINTED FROM A PiOGRA 
M:": PRINT : PRINT N$ : PRINT 
: PRINT 

130 PRINT "NICER PRINTOUT 0: STR 
ING N$:": PRINT : GOSUB 3500 
0: PRINT : PRINT 

140 PRINT "NICER PRINTOUT 0=' STR 
ING N$ ON LEFT HALF OF C 

OLUMN:": PRINT :M1 = 3 : 12 = 
1:M3 = 20: GOSUB 3500: iiRINT 
: PRINT 

150 END 



wrong with your magic machine; it just 
prints funny, sometimes. 

This is the wrong approach! We don't 
adapt to the computer's idiosyncrasies; 
it adapts to ours. Right? The little sub- 
routine at lines 35000 thru 35010 does a 
lot to help the wraparound problem. It is 
a human-oriented subroutine that prints 
on the screen using much the same 
rules we would use with a typewriter. 
Specifically, 

It will break a line at a space, comma, 
period, colon, hyphen, or other 
character you specify. 

If a word is longer than the allowable 
line, it will be hyphenated (rather ar- 
bitrarily, but this is a small sub- 
routine). 

At your pleasure, it will indent the first 
line of the output. This helps increase 
legibility. 

Four variables control the output for- 
mat. They may be entered once, at the 
beginning of a program, or they may be 
changed within the program if required. 
The variables used are: 



CW Column Width. This specifies 
the maximum columnar width 
of your output device, and is 
used for error catching. 

Ml Margin indent on the first line 
printed. 

M2 Margin indent on subsequent 
lines. (Note: Left justification 



October, 1979 



MICRO — The 6502 Jourral 



17:5 



35000 IF M3 - Ml >CW OR K3 - M2 
>CW THEN PRINT "LINE TO L 

ONG FOR PRINTER. ":PRINT iPRINT 
: END : REM CHECK FOR LINE 
LENGTH 

35001 LN - LEN (N?): FOR I = M3 - 
Ml TO 1 STEP - 1;BP5 = MID? 
(NS.I.l): IF BP$ = " " OR BP 

$ = "," OR BPS = ":" OR BPS = 
"." OR BPS " "-" OR LN < • 
M3 - Ml THEN 35003: REM FIN 
D BREAK POINT 

35002 NEXT I: HTAB Ml: PRINT LEFT? 
(N5,M3.- ^a - 1);: PRINT "-" 
:I = M3 - Ml - 1: GOTO 35004 

: REM HYPHENATE LONG WORD 

35003 HTAB Ml: PRINT LEFTS CNS, 
I): IF LN < = M3 - Ml THEN 

RETURN 

35004 N15 = RIGHTS (N$,LN - I) 

35005 IF LEFTS (NlS.l) = " " THEN 

LN = LEN (NIS) - 1:N1S = RIGHT? 
(N1$,LN): GOTO 35005: REM 
DELETE EXCESS SPACES 

35006 LN - LEN (NIS): FOR I - M3 

- M2 TO 1 STEP - 1:BPS • MIDS 

(NIS, 1,1): IF BPS = '■ " OR B 

PS = "," OR BPS - ":" OR BPS 

= "." OR BPS = "-" OR LN < 

= M3 - M2 THEN 35008: REM 

FIND BREAK POINT 



on the apple is HTAB 1, 
HTAB 0). 



not 



M3 Length of the line you wanted 
printed. 

N$ N$ is the dollar string you want 
nicely printed. You can form N$ 
through concatinatlon, or can 
make it equal to another string 
developed within the program. 

The word "Supercalifragalistlcexpili- 
docious" (Does anyone really know how 
to spell it) is entered in the string N$ of 
the sample run to point out two charac- 
teristics of the nice print subroutine. In 
the first nice print example, the length of 
the word has forced it down one line, 
leaving the preceeding line rather short. 
In the second example, where the word 
is longer than the allowable line length, 
super... is arbitrarily hyphenated. A short 
line should not appear too often with a 
40 column line length, since most words 
are 10 letters or less in length. 

Nicer writer is easy to incorporate into 
a program, and fast in execution. It will 
make your programs appear more pro- 
fessional and, best of all, it will keep 
your friends from asking questions like 



35007 MEXT I. HTAB Ml: PRINT LEFTS 
(N1$,M3 - M2 - 1);: PRINT "- 
":I = M3 - M2 - 1:LN = LEN 
(NIS): GOTO 35009: REM HYPH- 
ENATE LONG WORD 

35008 HTAB M2 : PRINT LEFTS (NIS 

,1) 

35009 IF LN < = M3 - M2 THEN RETURN 

35010 NIS =■ RIGHTS (NIS.LN - I): 
GOTO 35005 

PRINTOUT OF STRING NS AS IT MOULD NOR- 
MALLY BE PRINTED FROM A PROGRAM: 
THIS IS AN EXAMPLE OF A LONG SENTENCE TH 
AT COULD COME EITHER FROM A PROGRAM WRIT 
TEN FOR A 64 OR 80 COLUMN SCREEN OR PR IN 
TER, OR FROM ONE THAT CONCATINATES. SUP 
ERCALIFBAGALISTICEXPIALIDOCIOOS, NO? 
NICER PRINTOUT OF STRING NS : 

THIS IS AN EXAMPLE OF A LONG 
SENTENCE THAT COULD COME FROM EITHER A 
PROGRAM WRITTEN FOR A 64 OR 80 COLUMN 
SCREEN OR PRINTER, OR FROM ONE THAT 
CONCATINATES . 
SUPERCALIFRACALISTICEXPIALIDOCIOUS , NO? 



"Why did it print 
MPUTER'?" 



'CO 



I 



MICRO 'V ts published monthly by: 

MICRO INK. Inc 

34 Chelmsford Stieet 

Chtslm-'-ford. Massachusetts 

61725b-5'i1'i 

Si-conJ CiQAS post^qa paid if 
Ch^'imstor J. MA 01824 

Puiitriij'jter ^eim a-lJress changes to: 

MICRO 

PC Boifo502 

Criolirisfor.j. MA 01824 

Publi: ation NumhT- COTR 39577U 

Sut.:.- t.pt.on ,r-. United States. 
SK< 00 pet yjarM2 Issues 

For siibocnpTior^ and back issue- 
irfr.rmatioii A'lte to. 

MICRO 

P O. Bux 650J 

Chelm-.ifcrf|. MA '11B24 

USA 

Entire cont*'nt& Copyright ' 1979 by: 
MICRO INK. Inc. 



Subscription Information 

Subscriptions are available anywhere in 
the woild, Airmarl or Surface Please 
write for current subscription lates for 
your country. 

MICRO is carried by distributors in a 
number of foreign countries. A list of 
the largest distributors Includes: 

ConiputerLind Australia Pty. LtJ 
55 Cldrenot! Stieet 
Syclney. NSW 2000 
Australia 

L P. Enterprises 
313 Kingston Road 
lirord. Essex. England 

Micro Shnp Bodensee 
Mdrkstrasse 3 
D-7786 Markilorf 
West Gerrnany 

The Computnr Centre Ltd. 
5345 vVot'i Hup CoinpluA 
Beurjh Road 
Singapore 7 



Theie may ho signitirant differences in 
price ana dc-livery time between 
subscribing directly via MICRO INK. Inc 
and one of the distributors Check to 
determine which supplier is best suited 
to your inc]iviau?l needs. 



Bji.k Is.suefi a-e cier.orallv uvaMabie for 
rsausii nuint'er 7 or The materia! froM 
issue:. 1 thru 6 hdb been reorinted in 
book for.li as "The BEST of MICRO 
Volume 1". and tht- mat-Tial 'roai issues 
7 thru 12 hab b>jcri repiinted in book 'orm 
as "The BEST of MICRO Volume 2" 
TheSf t'AO bctjks may be tirdered dupct- 
Iv or may be obtamod from vour lonal 
comp-utf-' stoip jvtiich carrif*; MITRO. 



i[^[i(3[^(^ 




Disassembling the DOS 3.2 



You "Can't tell the players without a score card" and 
you can not effectively use the Apple II DOS 3.2 without 
this important information on its organization. 



William Reynolds 

1733 N. Ford Street 

McMinnville, OR 97128 



On the surface, DOS 3.2 is identical to 
DOS 3.1. Upon booting, the DOS is load- 
ed (slave or master), the greetings pro- 
gram is run, MAXFILES defaults to 3, 
and HIMEM is set at $9600. DOS 3.2 still 
communicates with the rest of the AP- 
PLE via input and output hootts at $36, 
37, 38, and 39. (All addresses refer to a 
48K machine.) 

The differences are many: In Apple- 
soft, DOS does the call 3314 or call 
54514 automatically, volume checking is 
ignored unless explicitly defined in the 
command, and the system defaults to 
NOMON C,l,0 status. The hooks at $36 
and 37 (the print routine) now contain 
$9E81 . The routine to restore DOS is now 
at $9DBF. This can be called if page 3 is 
overwritten. The command and error 
message tables are in different loca- 
tions. The command table is the same as 
in the DOS 3.1. The error messages, 
however, are quite different. After a 
BLOAD, A$ is now found at $AA72,3; L$ 
is now found at $AA60,1. 

When the keyboard input routine 
(9E81), is called, DOS checks the mode. 
If it is in direct mode, the DOS reads the 
keyboard, then goes to the print routine. 
The print routine has seven routines of 
it's own, 0-6. It calls the correct one, 
depending on whether the mode is 
direct, deferred, execute, read or write, 
etc. These routines are all inter-related. 

In direct mode, when a return is 
detected, DOS attempts to match the 
string in the keyboard input buffer 
($200-2FF) to a command in the table. In 



the print mode, direct or deferred, it 
stores ail characters in the keyboard in- 
put buffer until a return is detected. It 
then checks for a CTRL-D as the first 
character. If not found, DOS drops out 
and returns control to wherever it came 
from. However, if Control D is detected, 
DOS attempts to match the string to the 
command table. If a match is not made, 
it prints "Syntax Error". 

When DOS matches a command, it 
then checks for names, if needed, or 
numbers, if needed. After getting all 
data required, a check for optional data 
is made. After any optional data is read, 
numbers are changed to hex if need be, 
the maximum and minimum ranges are 
compared, then if all data is OK, the 
number is stored and DOS returns to 
check for any other optional data. 

A routine gets the correct address 
f.'-om the stack, then executes the com- 
mand. I have highlighted a few of the 
commands; 

PR# and IN# do the same function as 
in BASIC, except that DOS will set the 
hooks properly before releasing control. 

MON and NOMON set a mask at 
$AA74 as follows: 0= monitor nothing, 
$10= monitor 0, $20= monitor I, $40 = 
C, and combinations thereof. 

MAXFILES resets HIMEM and PP (INT 
BASIC) and allocates a file buffer via a 
subroutine at $A7D4. 



BRUN does a BLOAD then a 
($AA72). 



JMP 



RUN does a load, then jumps to a 
routine which executes the program. 

Which routine is used is dependent 
upon which language is being used, 
BASIC, FP RAM, or FP ROM. 

LOAD reads the file type and does 
either INT or FP as needed, then loads 
the program. When in FP mode, and 
after the program is loaded, DOS does 
the call 3314 or call 54514 as needed to 
set the program pointers for Applesoft. 

FP attempts to find a ROM card and 
turn it on. If possible, it sets the return 
addresses via a routine at $9D84. If no 
card is found, the DOS runs Applesoft, 
then goes to a routine at $9DEA to set 
return addresses correctly. 

INT makes certain the ROM card is 
off, then goes to $9084 to set return ad- 
dresses correctly. 

If a person wishes to use DOS from a 
language or operating system not stan- 
dard to the APPLE, there is no problem, 
unless an error is detected. If you do not 
wish an error message to cause a return 
to BASIC or Applesoft, the address at 
$9D5E and F can be changed for your 
particular system. 

Whenever a change in language is 
done, DOS updates it's return address 
stack from- the stack for that particular 
language. All commands except PR#, 
IN#, MON, NOMON, INT, FP (if in ROM), 
and MAXFILES go through routines that 
use file buffers. 



October, 1979 



MICRO — The 6502 Journal 



17:7 



All commands may be called from 
monitor or machine language, provided 

(1) A language change is not needed, (2) 
the file names have been placed into the 
name buffer(s), and (3) that any other 
parameters have been properly placed 
into their locations as needed. 

The disk controller card contains two 

(2) PROM'S, 256 bytes each. One PROM 
contains the program to start the 
booting of the DOS. The other is used for 
a program that, together with some 
other IC's, actually controls the head 
position, reading a bit, writing a bit, sen- 
ding the byte to the APPLE bus, and get- 
ting a byte from the APPLE bus. The 
following locations control the hardware 
functions. Add OOSO to each address, S 
= the slot number of the controller card. 

C080-87 These addresses sequen- 
tially step the motor that 



moves the head bacl< and 
forth. Odd addresses step 
one way, and even ad- 
dresses step the other way. 

C088 Turns off the drive motor. 

C089 Turns on the drive motor. 

C08A Enables drive two. 

C08B Enables drive one. 

C08C,D Control connecting the AP- 
PLE bus to the hardware for 
strobing the byte in or out of 
the 74LS323 IC shift regis- 
ter, depending upon the pre- 
viously set status of 
C08E,F. 

C08E,F Read/Write control. 

I have documented all routines, sub- 
routines, buffers, and other locations to 



the best of my ability in the memory 
maps that follow. Notes tell the function 
and usage of each. On most items I have 
given only the starting address. The end 
address is implied to be the next 
documented location minus one. On 
stacks of addresses, the parenthesized 
number is the number of addresses con- 
tained in that stack. Remember that any 
two-byte items are always stored low 
byte first. Documentation of addresses 
in the BOOO-BFFF area may be in error 
because that area got too complex for 
me to retain my sanity. 

My thanks to my family for their time 
and patience, to other persons for their 
articles on DOS functions, APPLE for 
their excellent documentation, without 
which i would have had no idea what 
was going on, and to Terry and Kent at 
Computerland of Portland, for use of 
their printer to obtain 60 feet of hard 
copy, and their moral support. 



APPLE II DOS 3.2 Memory Map 



95FF End of user RAM: HIMEM = 49151 

9600 Start of data buffer 

9700 Start of track and sector buffer 

9800 Start of miscellaneous info buffer 

982D Start of name of file 

9848, C Address of start of miscellaneous info buffer 

($9800) 

984D,E Address of start of track and sector buffer ($9700) 

984F,0 Address of start of data buffer ($9600) 

9851,2 Addressof start of name buffer, next file ($0000 = 

no more files) 

9853 Data 

9953 Track and sector 

9A53 Miscellaneous 

9A80 Name 

9A9E,F Address of start of miscellaneous info buffer 

($9A53) 

9AA0,1 Address of start of track and sector buffer ($9953) 

9AA2,3 Address of start of data buffer ($9853) 

9AA4,5 Address of start of name buffer of next file down 

($982D) 

9AA6 Data 

9BA6 Track and sector 

9CA6 Miscellaneous 

9CD3 Name 

9CF1,2 Address of start of miscellaneous info buffer 

($9CA6) 

9CF3,4 Address of start of track and sector buffer ($9BA6) 

9CF5,6 Address of start of data buffer ($9AA6) 

9CF7,8 Address of start of name buffer of next file down 

($9A80) 

9CF9- Unused 

9CFF 



9D00 Address of name of first file 

9D02 DOS keyin routine address 

9D04 DOS print routine address 

9D06 Name number 1 buffer address 

9D08 Name number 2 buffer address 

9D0A 

9D0C Bottom of DOS 

9D0E 

9D10 Address stack for the internal print routines (7) 

9D1 E Address stack for the DOS command routines (28) 

9D56 Address stack for return to the current language 

(6) 

9D62 Address stack for return to Integer BASIC 

9D6C Address stack for return to Applesoft ROM (6) 

9D78 Address stack for return to Applesoft Disk (6) 

9D84 (3D3G) Control B, re-enters INT or FP (ROM only) 

9DBF (3D0G) Restores DOS and re-enters current 
language 

9DEA Restores $3D0 - $3FF from $9E51 - $9E80 

9E51 Stack for the above routine 

9E81 Keyboard input routine 

9EBD Calls correct internal print routine, depending 
upon mode 

9ED1 Restores keyboard and print hooks 

9EEB Internal routine for information from the disk 

9F12 Internal routine for printing 

9F23 Prints and exits DOS 

9F2F Keyboard input internal routine 

9F52 Internal routine for sending information to disk 

9F61 Routine to correct internal routine 

9F71 Used by the EXEC command 

9F83 Mask MON status, print and exit 



17:8 



MICRO — The 6502 Journal 



October, 1979 



9FC8 Does a RETURN 

9FCD Start of section that attempts to match to a com- 
mand and get all information needed and all op- 
tional information given. Checks syntax and 
ranges before execution. 

A229 PR# routine 

A22E IN# routine 

A233 MON routine 

A23D NOMON routine 

A251 MAXFILES routine 

A263 Start of DELETE routine 

A271 Start of LOCK routine 

A275 Start of UNLOCK routine 

A27D Start of VERIFY routine 

A281 Start of RENAME routine 

A298 Start of APPEND routine 

A2A3 Start of OPEN routine 

A2EA Start of CLOSE routine 

A331 BSAVE routine 

A35D BLOAD routine 

A38E BRUN routine 

A397 SAVE routine 

A413 LOAD routine 

A4D1 Run routine 

A4E5 Runs Integer BASIC program 

A4F0 CHAIN routine 

A4FC Runs FP ROM program 

A506 Runs FP RAM program 

A510 WRITE routine (set up) 

A51B Read routine (set up) 

A54F INIT routine 

A56E Catalog routine 

A57A FP routine 

A59E INT routine 

A5C6 EXEC routine 

A5DD Position routine 

A60E Starts the read process 

A626 Starts the write process 

A644 Stores data coming from text file into keyboard 
buffer. Used by the EXEC command. 

A65E Error checking? 

A679 Closes files, exits DOS 

A682 Goes to hardware routines 

A69D Sets up address of name section of next file 

A6AB Close the buffer last used 

A6C4 Prints, "SYNTAX ERROR " 

A6C8 Prints, "NO BUFFERS AVAILABLE" 

A6CC Prints, "PROGRAM TOO LARGE" 

A6D0 Prints, "FILE TYPE MISMATCH" 

A6D5 Prints other error messages by message number 
contained in $AA5C 

A71A Moves parameters given to locations for use by 
hardware routines 

A743 Moves name from the name buffer to the name 
section of the file buffer 

A74E Moves addresses of sections of file buffers to 
locations for use by hardware routines 

A764 Attempts to find a file buffer already in use by the 
name given 



A74F 
A7C4 
A7D4 

A851 
A884 
A909 



October, 1979 



MICRO 



A941 

A94A 

A995 

A971 
AA3F 

AA4F,50 

AA51 

AA52 

AA53,4 

AA55,6 

AA57 

AA58 

AA59- 

AA5E 

AA5F 

AA60- 
61 

AA62- 

65 

AA66,7 

AA68,9 

AA6A,B 

AA6C,D 

AA6E,F 

AA70,1 

AA72,3 

AA74 

AA75 

AA93 

AAB1 

AAB2 

AAB3 

AAB4,5 

AAB6 

AAB7 
AAB8 
AAC1,2 
AAC3,4 

AAC5,6 
AAC7,8 
AAC9 
A ADS 
The 6502 Journal 



Checks file type 

Sets up file buffers and addresses (used by MAX- 
FILES) 

Restores DOS hooks 
Start of command table 

This is a table of two-byte masks. One byte is us- 
ed to determine what type of extra data is needed 
by a command. The other byte is used by the hard- 
ware routines for what file type to create or look 
for. 

Table containing the letters V, D, S, L, R, B, A, C, I, 
O. This is used when checking for optional data. 

Table of bytes for determining what type of op- 
tional data to look for. 

Table of minimum and maximum ranges for V, D, 
S, L, R, B, A. 

Start of error message table 
Relative address of start of error message, i.e. 
($A971,X) 

Address of name section of next available file buf- 
fer 

Internal print routine number 

PR# hooks out of DOS 

IN# hooks out of DOS 

Number of total file buffers 

Number of file buffers not in use 

Temporary storage used by various routines 



Mask for MON and NOMON 
Command number 
Found L$ from a BLOAD 

Temporary storage used by various routines 

Defined volume number 
Defined drive number 
Defined slot number 
Defined length 
Defined record number 
Defined byte number 
Defined address 

Start of file name buffer number 1 
Start of file name buffer number 2 

Control D 

Mode (direct, deferred, etc.) 



Value used for language, e.g. INT = 0, FP RAM 
CO, FP ROM = 80 



The name, "Applesoft" 
Address of start of lOB (used t)y RWTS) 
Address of start of buffer for track/sector list (us- 
ed by RWTS) 

Address of start of buffer for data (used by RWTS) 
Top of total RAM in the APPLE II 
Address stack for hardware routines (14) 
Address stack for hardware routines (6) 

17:9 



AAF1 Address stack for hardware routines (6) 

AAFD Goes to the correct hardware routine 

AB28 Reads VTOC and reads directory attempting to 

find an entry with the same name as the one 
given. If not found, checks the table of masks to 
see if it is allowed to create a file. If it may, it does 
so, and if not, it exits with "FILE NOT FOUND" or 
"LANGUAGE NOT AVAILABLE" 

ABDC Clears miscellaneous info hardware buffer; sets 

volume number, drive number and slot number. 

AC06 Close routine. Updates VTOC, track bit map, and 

sector count of directory entry as needed. 

AC3A Rename routine. Finds directory entry, stores new 

name in entry, then writes that directory sector 
back to disk. 

AC58 Goes to correct hardware routine 

AC70 Goes to correct hardware routine 

AC87 Sets parameters for following routine 

AC8A Actually reads text file 

AC93 Sets parameters for following routine 

AC96 Reads program or binary file 

ACA8 Puts byte being read into buffer 

ACBB Sets parameters for following routine 

ACBE Writes into text file 

ACC7 Sets parameters for following routine 

ACCA Writes program or binary file 

ACDA Gets byte being written from buffer 

ACEF Lock hardware routine 

ACF6 Unlock hardware routine 

AD12 Sets parameters for following routine 

AD18 Verify hardware routine 

AD2B Delete hardware routine 

AD54 Part of delete routine, frees sectors used by 

deleted file. 

AD98 Catalog hardware routine 

AE42 Part of catalog, prints the number in $44 as three 

digit ASCII. 

AE6A Moves miscellaneous info from the file buffer to 

the hardware buffer. 

AE7E Moves miscellaneous info from the file buffer to 

the hardware buffer. 

AE8E Initialize hardware routine 

AF08 Sets 42 and 43 as pointers to sections of the file 

buffer 

AF1D Writes data section of file buffer to disk 

AF34 Writes track/sector list section of file buffer to 

disk 

AF4B Sets hardware pointer to the track and sector list 

section of the file buffer being used 

AF5E Checks position in file. If out of current sector, 

reads/writes next sector, updates VTOC buffer, 
updates track/sector list section of file buffer if in 
write mode. 

AFDC Reads from disk into data section of file buffer 

AFE4 Sets hardware pointers to data section of file buf- 

fer being used 

AFF7 Reads VTOC to its buffer ($B3BB - B4BA) 

AFFB Writes VTOC from its buffer 

B011 Reads a directory ^sector into its buffer 

('B4BB-B5BA). Initially reads sector A, suc- 
cessive entries into this subroutine read suc- 
cessive sectors from the disk. When all sectors 



B037 

B052 
BOAO 
B0A1 
B0B6 

B134 
B15B 
B194 
B1A2 
B1B5 
B1C9 

B21E 

B224 

B2C3 

B2DD 

B300 

B35F 

B397- 
A6 

B3A7- 
AA 

B3AB,C 

B3AD - 
BA 

B3BB 

B4BB 

B5BB- 
00 

B5D1- 
FF 

B600 

B700 



B74A 

B793 

B7B5 
B7C2 

B7DB 

B7E7 

B800 

BA90- 
FF 

BBOO 

BCOO 

BDOO 

BFD4 

BFD5 

BFFF 



have been read and the subroutine is called again, 
it will merely exit with the carry set. 

Writes current directory sector from buffer to 
disk. 

Sets up lOB for directory sectors, goes to RWTS 

End of above if no error 

Start of error handling routine for above 

Checks position in file, reads/writes next sector 
as needed 

Initializes data section of file buffer to all zeroes 

Sets next position in file 

Increments position in file 

Sets next RAM address 

Calculates how much RAM is left 

Reads VTOC and successive entries, attempting 
to find the specified file name. 

Puts name of file into directory 

Sets next sector, updates VTOC buffer 

Updates VTOC 

Calculates track bit map for VTOC 

Sets/checks parameters for file? 

Routine with different entry points to exit the 
hardware routines with error 

Temporary storage for hardware routines 
T, I, A, B Used by catalog for file types 



In reverse order, the string, "DISK VOLUME" 

VTOC buffer 

Directory buffer 

Temporary storage for hardware routines 

Miscellaneous info section of currently used file 

Buffer. Purpose? 

Reads drive 1, current slot, $B1 sectors, track 0, 
sector A into RAM starting at $1B00. Boot 
routine? 

Writes $0A sectors, starting from $B600, then $1B 
sectors, starting at $1B00, beginning at track 
sector 0. 

Increments track/sector as needed and data ad- 
dress for above two routines 

Calls RWTS, checks status upon return 

Sets address of data buffer, and sets expected 
volume number 

Stores zeroes in one page, starting at the address 
in $42, 43 

Start of lOB and device characteristics table 

Part of RWTS? 

Temporary storage for RWTS? 

One-page buffer (RWTS?) 

One-page buffer (RWTS?) 

Start of RWTS 

End of RWTS 

Various endings sections for the hardware 
routines 

End of RAM 



17:10 



MICRO — The 6502 Journal 



October, 1979 



Hooking PET to Ma Bell 



The dream of many microcomputerlsts to use their 
system as a terminal connected to a large computer 
system can become a pratical reality. The $50.00 hard- 
ware for any 6502 based system, and the software for a 
PET, are fully described. 



C.H. Scanlon 

P.O. Box 22 
Arkansas State University 
State University, AR 72467 



Having worked with my 8K PET for 
almost a year, I have become hooked on 
microcomputers and am enjoying learn- 
ing and experimenting with a great 
machine. Like most microcomputer 
enthusiasts, I dream of more memory, 
disks, printers, etc. However, attempting 
to raise a family on a teacher's pay 
means that I have limited funds. So I 
wired up a PET to RS-232 modern inter- 
face, plugged Into a modem, and 
bingo — by dialing up the computer 
system on the campus of Arkansas 
State University, I have all of these plus 



much more hooked to my PET. If you 
have telephone access to a computer 
system or a friend with an answer 
modem on his computer, here is the 
hardware and software to get you 
started communicating on the 
telephone. 

The Interface shown in Figure 1 can 
be built for under $50 including connec- 
tors, wiring, etc., and can be plugged 
into any RS-232 modem (I have a U.S. 
Robotics Model 310 which lists for $149). 
A TTL compatible modem can be wired 



10 REM 
20 REM 
30 REM 
40 REM 
50 REM 
60 REM 
101 DATA 



TERMINAL PROGRAM 

BY C.H. SCANLON 

P.O. BOX 22 

STATE UNIVERSITY, ABKANSAS 

72467 



102 DATA 145, 224, 



173, 246, 191, 48, 3, 76, 133, 230, 173, 247, 
191, aa, 41. 127, 170, 169, 32, 172, 226, 
13a, 32, 210, 255, 169, 160, 172, 
226, 0, 145, 224, 76, 133, 230 

105 FOR I - 826 TO 861: READ X: POKE I, X: NEXT 

110 POKE 537, 58: POKE 538, 3 

115 POKE 49142, 3 

120 POKE 59468, 14 

130 PRINT "(cs) * * * * TERMINAL * * * *" 

140 PRINT "(cd)(cd) Type RUN 190 but don't hit the return yet". 

150 PRINT "(cd) Dial 935-9372 and wait for the tone". 

160 PRINT "(cd) Place receiver in holder and hit return". 

180 STOP 

190 POKE 49142, 129 

195 FOR I - 1 TO 30: NEXT: POKE 49143. 7 

200 GET A$: IF A$ - "" GOTO 200 

210 IF ASC(A$) - "shift S" THEN PRINT "Ccs)" 

215 IF ASC(A$) < 192 GOTO 300 

220 IF ASC(A$) > 244 GOTO 300 

225 POKE 49143, ASC(A$) - 192: GOTO 200 

300 POKE 49143, ASC(A$) : GOTO 200 



NOTE: (ca) means clear screen and Ccd) means cursor down. 

Figure 2 
October, 1979 



MICRO — The 6502 Journal 



directly to pins 2 and 6 of the MC6850. 
All the parts, except the crystal, are fair- 
ly common and can be ordered from 
most mail order electronics parts firms. 
The 1.229 megaHertz crystal can be 
ordered from any crystal manufacturer 
for around $10. This Interface can be 
connected to any 6502 or 6800 based 
microcomputer that allows direct 
access to the microprocessor bus, for 
example, the APPLE, KIM, SYM, SWT, 
OSI, etc. 

The software is written In BASIC and 
makes the PET act like a TTY type 
"dumb" terminal. The control characters 
are obtained by using the shift key. For 
example, control S is simply shift S. 
Although this program appears to limit 
the PET, it really doesn't since you can 
hit the stop key, write and run a program 
in the extra RAM and get back to the ter- 
minal program with a RUN 190 or a 
GOTO 190. For example, you could write 
a BASIC program starting at line number 
500, compute a bunch of data, POKE the 
data to the modem, and then return to 
the terminal program with a GOTO 190. 

Software 

The MC6850 Asynchronous Com- 
munications Interface Adapter (or, in the 
buzz words of computerland, simply 
speak the letters A-C-l-A) is located In 
page B and has multiple addresses. I 
use hex BFF6 = 49142 as the address to 
POKE to the control register and to 
PEEK at the status register. Address 
BFF7 = 49143 is used to POKE a byte to 
the modem and to PEEK at a byte from 
the modem. 

The BASIC program provides direc- 
tions for the operator, data transfer from 
the modem to PET, data transfer from 
PET to the modem, and miscellaneous 
programming needs. 

Lines 101 - 105 POKE a machine 
language routine into the second 
cassette buffer, and line 110 POKEs the 



17:11 



PET MEMORY EXPANSION PORT 



A28 = 
A2 = 



IRQ- 
3A1 — 



A25 - SELB- 

A3 = BA2 

A1 = BAO 
A30 = R/W- 
A29 = 802 — 
AtO = BD7 — 
A39 = BD6 — 
A38 = BD5 — 
A37 = BD«- 
A36 = BD3- 

A35 = BD2 

A3t = BDl 
A33 = BDO 
Bl = GND 



r 



13 R/W 
It E 

15 D7 

16 D6 

17 D5 

18 Dt 

19 D3 

20 D2 

21 Dl 

22 DO 

23 D4D 

24 CTS 



DD 
RS 11 
CS1 10 
CS2 9 
CSO 8 
IRQ 7 
TXD 6 
RTS 5 
TXCLKt 
RXCLK3 
RXD 2 
VSS 1 



12 -+5 



MC6850 



-NC 



32 




1.229b] 



IK 



IZZl 



5 pr 



s 



9 




8 


10 




7 


11 


o 


6 


12 


o 


5 


13 


=r 


i| 


m 


o 


3 


15 




2 


16 




1 



2N2222 



15K 



INtlM? 




Figure 1 



address of this routine into ttie interrupt 
address location of RAM so that, when 
an interrupt occurs, PET will check the 
ACIA before it checks the other possible 
interrupt locations. 

When the ACIA receives a serial byte 
from the modem, it strips off the start 
and stop bits, converts it to parallel, and 
then interrupts the CPU. PET is then 
routed to the routine beginning at 033A. 

Lines 033A - 033C transfer the con- 
tents of the ACIA status register, to 
register X and lines 033D - 033E cause a 
branch if bit 7 is set, indicating that the 
ACIA did interrupt the CPU and has a 
byte to transfer. Otherwise, lines 
033F - 0341 transfer PET to the ROM in- 
terrupt sequence. Lines 0342 - 0344 
transfer a data byte from' the ACIA to 
register A and line 0345 clears the CPU 
interrupt to allow for other interrupts. 
Lines 0346-0347 strip the parity bit 
from the data byte and line 0348 
transfers it to register X for temporary 
storage. 



Next, to erase the cursor, lines 
0349-034A load A with $20 (note that 
CHR$(32)is a blank). Lines 034B-034D 
get the current position of the oursor on 
the video line and lines 034E - (I34F then 
clear the cursor. 

To type the character, line 0350 
retrieves the data byte from register X 
and stores it in register A and lines 
0351 - 0353, then types the character in 
the next print position. 

To set the cursor, lines 0354 - 0355 
load register A with SAO (rote that 
CHR${160) = reverse blank), lines 
0356 - 0358 get the current position of 
the cursor on the video line, iind lines 
0359 - 035A then set the cursor. 

Lines 035B - 035D then transfer con- 
trol back to the PET interrup': routine. 
Back in the BASIC program, line 115 
POKES 3 into the ACIA control register 
which then resets the ACIA. Line 120 
sets the lower case letter mode and then 
lines 120-180 print instruct ons and 
stop. 



Since the answer modem at Arkansas 
State University uses seven bits plus 
parity plus two stop bits, line 190 pro- 
grams the ACIA to transfer data in this 
mode. Reference 1 explains how to pro- 
gram other modes. Also, since the 
Arkansas State University computer in- 
itially waits for a control G, line 195 has 
a delay and then POKEs a 7 = ASCII 
CTRL-G to the modem. Lines 200 - 300 
then wait to get a character from the 
keyboard, convert the character to 
ASCII, and POKE it to the ACIA. 

Hardware 

The MC6850 is wired directly to the 
CPU bus through the memory expansion 
port. I use page B by wiring CS2 to SELB. 
Details of programming the ACIA can be 
found in reference 1. 

The 1.229 megahertz cystal and the 
C4060 counter put out a 4800 Hertz 
square wave to the ACIA. The ACIA fur- 
ther divides it by 16 to obtain a baud rate 
of 300. Reference 2 indicates how to get 



17:12 



MICRO — The 6502 Journal 



October, 1979 



other baud rates. The 741 op amp 
converts the RS-232 logic from the 
modem to TTL as described in reference 
3. 

You will need a ±12 and +5 volt power 
supply. If you use a TTL compatible 
modem, you won't need the M2 volt 
supply and you can get +5 volts from the 
second cassette port. 

Questions 

There are lots of software questions I 
have not answered. For example, how 
can a program be copied directly from 
the cassette to the modem? How can a 
program or data file be "saved" by sen- 
ding it to the storage facilities at the 
other end of the line and how can it be 
retrieved later? With the exception of 
displaying more characters, what can an 
expensive "smart" terminal do that PET 
can't do? As I stated earlier, this article 
is merely a start. 

References 

1. An Introduction to Microcomputers 
Volume II, by Osborn, Jacobson, and 
Kane, Adam Osborne and 
Associates, Incorporated. 



MICRO-WARE ASSEMBLER 65XX-1.0 PAGE 01 



0010: 










0020: 










0030: 


033A 








OOUO: 


033A 


AE 


F6 


BF 


0050: 


033D 


30 


03 




0060: 


033F 


4C 


85 


E6 


0070: 


0342 


AD 


F7 


BF 


0080: 


0345 


58 






0090: 


0346 


29 


7F 




0100: 


0348 


AA 






0110: 


0349 


A9 


20 




0120: 


034B 


A4 


E2 




0130: 


034D 


91 


EO 




0140: 


034F 


8A 






0150: 


0350 


20 


D2 


FF 


0160: 


0353 


A 9 


AO 




0170: 


0355 


A4 


E2 




0180: 


0357 


91 


EO 




Q190: 


0359 


4C 


85 


E6 


ID = 











ORG 


$033A 


LDX 


$BFF6 


BMI 


$0342 


JMP 


$E685 


LDA 


$BFF7 


CLI 




AMDIM 


$7F 


TAX 




LDAIM 


$20 


LDY 


$00E2 


STAIY 


$E0 


TXA 




JSR 


$FFD2 


LDAIM 


$A0 


LDY 


$00E2 


STAIY 


$E0 


JMP 


$E685 



Figure 3 



2. CMOS Cookbook by Don Lancaster, 
Howard W. Sams and Company, In- 
corporated. 



GET STATUS REGISTER OF ACTA 

BRAHCH IF BIT 7 SET 

JUMP TO PET INTERRUPT 

GET BYTE FROM ACIA 

CLEAR INTERRUPT FLAG 

STRIP OFF PARITY BIT 

STORE THE BYTE 

CHR(32) = BLANK 

GET CURSOR POSITION ON LINE 

CLEAR CURSOR 

RETRIEVE THE BYTE FROM X 

TYPE IT AS A CHARACTER 

CHRC160) = REVERSE BLANK 

GET CURSOR POSITION ON LINE 

SET CURSOR 

JUMP TO PET INTERRUPT 



3. Peripheral Interfacing by Rod Hallen, 
KILOBAUD Microcomputing, June 
1979. 



T.D.O. 
TAPE DATA QUERY 



PET-8K 



SOL-IIA 



TRS-80-LEVEL II 



■* FILE MANAGEMENT SYSTEM 

—Utilizes Dual Audio Cassette Recorders 
■* INTERACTIVE QUERY LANGUAGE 

— English-Lilce Commands 

—Powerful Info Retrieval Capability 
* COMPUTERIZED BUSINESS & PERSONAL RECORDS 

—Customize Your Own File Structures 

—Create & Maintain Data Files 

—No Programming Experience Required 
■* IMPLEMENTED IN BASIC 
T.D.O. CASSETTE WITH MANUAL & REF. CARD S50.00 

The Following Pre-Defined T.D.Q. File Structures 
Are Available To Solve Your Data Processing Needs: 

INVENTORY CONTROL 535.00 

ACCOUNTS RECEIVABLE $35.00 

ACCOUNTS PAYABLE $35.00 

ORDER PROCESSING $35.00 

CUSTOMER DIRECTORY $25.00 

APPOINTMENT SCHEDULING $25.00 

Each With Cassette And Manual 

Send Self- Addressed Stamped Envelope For 

Complete Software Catalogue. 

Send Check Or Money-Order To: 

H. GELLER COMPUTER SYSTEMS 

DEPT. M, P.O. BOX 350 

NEW YORK. NY 10040 

(New York Residents Add Applicable Sales Tax) 



NOW AVAILABLE 
For SOL-IIA and PET-8K 

GENERAL PACK 1 $11.00 

(Checkbook Balancer, Tic Tac Toe, Metric Conversion) 

GENERA^ PACK 2 $19.00 

(Space Pcitrol, Biorhythm, Battlestar, One-Armed Bandit) 



FINANCIAL PACK 1 

(Loans, Ciepreciation, Investments) 



$13.00 



FINANCI.\L PACK 2 $13.00 

(Mortgage & Loan Amortization, Future Projections, 
Risk Analysis) 

STATISTICS PACK 1 $19.00 

(Mean & Deviation, Distribution, Linear Correlation & 
Regressian, Contingency Table Analysis) 

GAME PACK 1 $20.00 

(Basketball, Object Removal, Bowling, Darts, Gopher) 



GAME PACK 2 - (children - educational) 
(Arithmetic God, Addition Dice, Travel) 



$13.00 



For the KIM-1 
PCROS - A Real-Time Operating System in the $50.00 
IK KIM RAM 

Includes: Assembly listing; Cassette with user's 
manual; Schematic for relay control board 



October, 1979 



MICRO — The 6502 Journal 



17:13 



Software for the APPLE 




THE PLANETS 



$15.95 




STATE CAPITALS 



$9.95 



FORMAT 

PROGRAMMA's FORMAT (Version 1.0) 
is a command oriented text processor de- 
signed to be fully compatible with PIE 
(PROGRAIVIIVIA Improved Editor). 

FORMAT'S system of imbedded comm.mds 
(within the text) give it an ease of oper- 
ation similar to text formatters found on 
some mini-computers. 

FORMAT features right margin justifi- 
cation, centering, page numbering, and 
auto-paragraph indent. 

The following commands are available 
with FORMAT: 



Begin adjusting right margins 

Begin page numbered n 

Cause a line break 

Center next n lines without fil 

Start filling output lines 

Foot title becomes t 

Head title becomes t 

Indent n spaces from left margin 

Literal, next n lines are text 

Line length including indent is n 

Set line spacing to n 

Top spacing including head title 

Spacing after heading title 

Spacing before foot title 

Bottom spacing including foot title 

Stop adjusting right margins 

Stop filling output lines 

Page length is n lines 

Begin paragraph= .sp, .fi, .ti n 

Space down n lines, except at lop 

Temporary indent of n 

Underline next n input lines 



All orders include 3% postage and handlinci. 
Apple II is a registered trademarl< of Apple 
Computer, Inc. 

California residents add 6% Sales Tax 
VISA & MASTERCHARGE accepted. 




LUNAR LANDER 



$9.95 





PROGRAMMA 
INTERNATIONAL, Inc. 

3400Wilshire Blvd. 
Los Angeles, CA 9001 

(213) 384-0579 
384-1116 
384-1117 



DO) 



SPEEDWAY 



$15.95 



JOY STICK $49.95 

EXPAND-A PORT $49.95 



Dealer Inquiries Invited 



J 





a 

c 
n 

ct 
01 




ct 

t 

Ql 
(D 



Spelunker 



Spelunker is not for the faint of heart! It presents many 
interesting and useful programming techniques in the 
pleasant format of a game. As you play, keep telling 
yourself "It's only a game, it's only a game ..." 



Thomas R. MImlitch 

1547 Cunard Road 

Columbus, OH 43227 



This is an adventure fantasy series in 
which you become directly involved in 
exploration of a mysterious cavern in 
southwest Kentucl^y called Devils' 
Delve. If you have never played before, 
you should take a guide along. The guide 
will read the chamber descriptions as 
you erter each room for the first time. 
He can also supply some hints and clues 
to help you when you are stuck. Only the 
guide should use the room descriptions, 
word lists, and the map of the caverns. 
However, younger players may need 
some of these aids to help them. 

Spelunker is an Interactive game. You 
must converse with the program In order 
to explore the caverns and locate their 
treasures. You can talk in sentences, if 
you wish; but the program will use only 
one verb and one noun to establish 
meaning. For this reason, it is best to 
converse in verb/noun phrases. In the 
case of moving from chamber to 
chamber, for example, enter "GO W" or 
simply "W" and the verb "GO" will be 
implied. The Spelunker program will 
move you into the next room to the west 
upon receiving this command. Other ex- 
amples might include "TAKE LIGHT" or 
"JUMP DOWN". 

With this brief introduction you 
should be ready to explore the caverns 
of Spelunker. While you are about it, try 
drawing a map of the cave. You may also 
wish to discover exactly what 
vocabulary is understood by the pro- 
gram. The material that follows is for the 
guide only — so don't ruin your first 
adventure by peeking at it. 

For the Guide Only 

In the 16K APPLE II version of 
Spelunker, the chamber descriptions are 
not part of the program because of 
limited memory size. These room 
descriptions have been prepared for the 
adventurer's guide. The guide may read 
each room description as the adventurer 
enters the chamber for the first time. 

1. Mouth: You are at the mouth of a 
large cavern. The sides of the en- 
trance slope steeply upward, and a 
mysterious passage leads west into 
the cave. 



2. Tree room: A towering, withered 
tree stands In what appears to be a 
dried up river bed. From it you seem 
to hear echoing sounds saying, 
"Water.. .water.. .water..." 

3. Writing room: Do not read this 
description if the room is dark. The 
writing room is a large, oval 
chamber with tall ceilings and 
massive stalagmites. The smooth 
eastern wall has some writing on 
it — cryptic characters that spell 
out, "THE SPIRITS OF THE FRUIT." 

4. Pit room: A small chamber with an 
immense stalagtite hanging from 
the center of the ceiling, directly 
over the mouth of a bottomless pit. 

5. South lake shore: You stand at the 
edge of a misty lake that stretches 
endlessly out before you to the 
north. 

6. West lake shore: You are standing 
on a damp, sandy shoreline with a 
very low passage leading off to the 
west. A clammy draft issues from 
the low-ceilinged passage. 

7. North lake shore: A small, sandy 
beach on the northern edge of Misty 
Lake. 

8. Maze room: Also known as the 
Swiss cheese room. You loose your 
sense of direction because twisting 
passages are coming and going at 
all points of the compass. 

9. Frozen river room: What appears to 
be a petrified river bed slopes gent- 
ly upward leading toward he west. It 
has a low, four-foot ceiling. 

10. SwifUriver room: You hear swiftly 
running water, as you enter this 
room, and you see a narrow, churn- 
ing, underground river flowing to 
the south. 

11. Hub room: A magnificently 
decorated chamber with crystaline 
designs and intricate rock forma- 
tions. A narrow, fast moving river 
flows through the hub room. 

12. Ice room: Mysteriously, ice forms 



very quickly in this chamber, encap- 
sulating anything left there for too 
long. There is so much ice that you 
can't even get into the room; 
however, you see an exit on the 
other side of the chamber. 

13. Chimney room: A small, smoke fill- 
ed chamber with a fire burning in a 
natural fireplace in the north wall. 
Apparently, a chimney leads far up 
through the rock and out of the 
cavern. 

14. Gold room: As you enter this room, 
the first thing that you notice is a 
pile of golden treasures nestled into 
a nook on the far side. Before you 
take another step, a foul-smelling 
ogre jumps out from a hole in the 
side wall and rushes forward to pro- 
tect his gold. 

15. Bones room: Lining the walls of this 
chamber are the skeletons of 
pirates long since dead. An om- 
nious curse is uttered by all of the 
skeletons in unison, as you enter 
the room, and the curse shadows 
your travels throughout the cavern. 

16. Bat room: The ceiling is all but in- 
visible for the tens of thousands of 
bats sleeping there. In one corner of 
this room lies an old, rusted chest. 
As you open the chest, the bats 
begin to stir. Inside the chest is a 
king's ransom in jewels: diamonds, 
rubies and emeralds. 

17. Ghost room: An eerie feeling of 
demonic power lurks in this 
chamber. 

18. Misty Lake: You are in the middle of 
Misty Lake. A strange glow 
emanates from the bottom of the 
lake. You turn off your light and 
notice an enormous, bright pearl 
nestling inside a gigantic clam. The 
clam is at the bottom of the lake, in 
only ten feet of water. 

19. Swift River: This narrow, fast flow- 
ing river is outside the cavern. It 
runs south for a few yards and then 
disappears underground. 



October, 1979 



MICRO — The 6502 Journal 



17:15 



Having been exposed to a fantasy pro- 
gram called Adventure which seems to 
reside on many large timesharing net- 
worl<s, I was challenged to see if this 
type of game could be handled on a 
micro. Thus the dream stage began. I 
thought up monsters, treasures, a cave 
structure, tools, tricl<s and battles. The 
major goals emerged: 

Pseudo-English input commands 
(verb-noun phrases) 

Interconnected rooms one could 
travel through 

Objects one could tal<e, put, carry 
and use 

Monsters/ treasures; do battle, take 
rewards 

Secrets to be discovered 

The obvious method was to tabularize 
as much data as possible so that similar 
functions could be implemented as 
subroutines. This left only special handl- 
ing routines to be added. 

The program was organized into five 
major sections. Lines numbered 30xxx 
initialize the tables and variables. Lines 
numbered 4xxx to lOxxx print out the 
current location and status for the 
player. Lines numbered Ixxx read and 
decode the input string. Lines in the 
2xxx range perform the command ac- 
tion, if possible. In lines with 3xxx 
numbers the monsters have an oppor- 
tunity to react to their environment. 
Each of these sections was developed. 



Table 1: Sample word tables for the guide. 

The following lists of verbs and nouns are for use if you are 
having difficulty in communicating with Spelunl<er. Not all of 
these words have meaning or utility in this adventure. I didn't 
want to make it too easy! 



VERBS 












BITE 


CARRY 


CLIMB 


DIG 


DRINK 


DRIVE 


DROP 


EAT 


FIGHT 


GO 


HELP 


HIT 


JUMP 


KILL 


PUT 


RUB 


RUN 


START 


STOP 


TAKE 


THROW 


USE 


WALK 


WISH 


NOUNS 












APPLE 


AX 


BATS 


BOMB 


BONES 


CAVE 


CHEST 


CLAM 


CURSE 


DOWN 


E 


FIRE 


GHOST 


GOLD 


ICE 


KNIFE 


LAKE 


LAMP 


LIGHT 


N 


NE 


NW 


OGRE 


PEARL 


RAFT 


RIVER 


ROPE 


S 


SE 


SW 


TENT 


TREE 


TRUCK 


UP 


W 


WATEF 



tested and integrated separately from 
the others. 

Input commands 

A list of verbs and nouns was developed 
and categorized as to nature or function. 
After entering these tables into the pro- 
gram, I worked on the routine to read 
and decode input commands. Each word 
was picked out of the input string, then 
searched for in the noun and verb lists. 
The first recognized verb and noun 
numbers were the output of this routine, 
and this output controlled the action 
routines. I later added an edit to com- 
pare the noun type and verb type to see 
if they were compatible. 



Objects to take and put 

Parallel to the noun list is the status 
list which gives the room number where 
an object currently resides. A -1 in- 
dicates that the object is in the posses- 
sion of the player. In the output section, 
objects in the current room (LOC) were 
printed and the objects in the players 
possession were also reported. The se- 
cond action routine was added nex- 
t — the TAKE and PUT routine. TAKE 
changed the status of a noun to -1, 
while PUT set its status equal to LOC. 
Again I tested the program and played 
with it, moving things all over the caves. 



Verb 



Type 



Verb Table 
Sensative Noun Types 









Direction 


Location 


Weai 


1 


GO 




X 






2 


JUMP 


11 


X 


X 




3 


RUN 




X 






4 


WALK 




x 






5 


DRIVE 




X 






S 


CLIMB 


3 


X 


X 




7 


DIG 


2 




X 




8 


CARRY 


116 






X 


9 


DROP 


116 






X 


10 


PUT 


116 






X 


11 


TAKE 


116 






X 


12 


USE 


36 






X 


13 


WISH 


36 






X 


14 


THROW 


4 






X 


15 


HELP 


8 








16 


KILL 


8 








17 


STOP 


40 








18 


HIT 


8 








19 


FIGHT 


8 








20 


RUB 


16 








21 


START 


32 








22 


DRINK 


64 








23 


EAT 


64 








24 


BITE 


64 









Tools 



Foods 



17:16 



MICRO ~ The 6502 Journal 



October, 1979 



Cave room structure 

The map was finalized, giving each room 
a number. The interconnections were 
entered Into the N, E, S and W arrays, 
with a positive number Indicating an exit 
In that direction to the room number 
specified. A series of statements were 
inserted in order to print out the current 
room descriptions, but at the time only 
the room name was printed. Later I 
discovered that there was not enough 
memory to put In the complete descrip- 
tions In any event. 

The first of the action routines — the 
MOVE routine — was coded next. If 
there was a possible move in the re- 
quested direction, the LOG variable was 
set to the new room and its description 
was printed. This portion was a lot of fun 
to test and debug. 

Monsters, treasures and battles 

The monsters and treasures were 
merely noun objects in the caves, like all 
of the other things. A relationship was 
defined between the monster, his 
treasure, the player, and the player's use 
of weapons. Thus grew up the monster 
table and the weapons table. The 
monster table identifies the monster, 
determines his strength, defines his 
treasure, identifies his home chamber, 
and determines how quickly he moves 
about the caves. The monsters move 
through the caverns to find their 
treasures if they are stolen. In the table 
are certain base probability factors for 
the monster to kill the player, steal all 
the player's treasures, or steal only the 
treasure than originally belonged to the 
monster. 

The weapons table details the power 
of each of the player's weapons and 
determines which monsters they are ef- 
fective against. The next action routine 
was ready to Implement: the ATTACK 
routine. This is invoked whenever a 
weapon is used, put, thrown, and so on. 
Any monsters In the room are attacked, 
and their life forces are decreased by a 
random amount limited by the force of 
the weapon used. When a monster's life 
force Is reduced to zero, it is eliminated. 

Of course, it Is not fair to let the player 
cut the demons to shreds without allow- 
ing them to fight back. Thus came the 
REACTION routines. Happy monsters 
are those that have their own treasures 
in their room and have not been attack- 
ed. Any monsters that are not happy will 
seek someone to vent their anger upon, 
and that person Is the player. A very in- 
tricate set of probabilities decides the 
outcome of this anger. The more the 
monster has been hurt by the player's at- 
tacks, the weaker his counterattack will 
become. But also, the more times he has 
countered in vain, the madder he gets! 
Nothing is more deadly than a mad 
monster. 







Noun Table 




Noun 


Type 




Status (Lo< 


1 


N 


Direction 







2 


NE 


Direction 







3 


E 


Direction 







4 


SE 


Direction 







5 


S 


Direction 







6 


SW 


Direction 







7 


W 


Direction 







8 


NW 


Direction 







9 


UP 


Direction 







10 


DOWN 


Direction 







11 


CAVE 


Location 







12 


LAKE 


Location 







13 


RIVER 


Location 







14 


TREE 


Location 







15 


AX 


Weapon 


4 = 


Pit 


16 


BOMB 


Weapon 


3 = 


Writing 


17 


CURSE 


Weapon 


15 = 


Bones 


18 


FIRE 


Weapon 


13 = 


Chimney 


19 


KNIFE 


Weapon 


1 = 


Mouth 


20 


CLAM 


Monster 


18 = 


Misty Lake 


21 


BATS 


Monster 


16 = 


Bat 


22 


BONES 


Monster 


15 = 


Bone 


23 


GHOST 


Monster 


17 = 


Ghost 


24 


OGRE 


Monster 


14 = 


Gold 


25 


CHEST 


Treasure 


16 = 


Bat 


26 


GOLD 


Treasure 


14 = 


Gold 


27 


PEARL 


Treasure 


18 = 


Misty Lake 


28 


LAMP 


Treasure 


12 = 


Ice 


29 


RAFT 


Tool 


5 = 


South Shore 


30 


ROPE 


Tool 


9 = 


Frozen River 


31 


TENT 


Tool 


1 = 


Mouth 


32 


TRUCK 


Tool 


1 = 


Mouth 


33 


LIGHT 


Tool 


1 = 


Mouth 


34 


WATER 


Food 







35 


APPLE 


Food 







36 


ICE 


Water 


12 = 


Ice 









Room Table 


Room 


Tunnel Connects 


Notes 




N 


E 


S 


W 




1 Mouth 


50 




19 


2 


Truck Tent Knife Light 


2 Tree 




1 


3 






3 Writing 


2 




10 


20 


Bomb 


4 Pit 




20 






Ax Use rope to go down 


5 South Lake Shore 


-18 








Raft-north Rope-up 


6 West Lake Shore 




-18 




12 


Raft -east 


7 North Lake Shore 


9 




-18 




Raft-south 


8 Maze 


8 


9 


8 


20 


All 45's return to Maze 


9 Frozen River 


7 


1 




8 


Rope 


10 Swift River Room 


3 




-11 




Raft-south 


11 Hub 


13 


14 


-49 


21 


- 15 22 12(NESESW NW) 


12 Ice 






11 


6 


Ice Lamp 


13 Chimney 






11 




Fire Rope-up 


14 Gold 








11 


Gold Ogre 


15 Bones 








11 


Curse Bones 


16 Bats 


22 








Chest Bats 


17 Ghost 




21 






Ghost 


18 Moosty Lake 


7 




5 


6 


Pearl Clam 


19 Swift River 


1 










20 Intersect 1 


8 


3 




4 




21 Intersect 2 




11 


22 


17 




22 Intersect 3 


11 




16 


21 




49 Falls (Over) 










Death 


50 Home 










End game 



October, 1979 



MICRO — The 6502 Journal 



17:17 



Lots of testing and refinements later, 
SPELUNKER took its maiden voyage. 
Surely a program like this is never finish- 
ed. The frameviiork has been laid for all 



sorts of adventures, viihatever one can 
imagine. And, now/ that I have more 
memory, I can expand the scope and 
capabilities of the program. 





Monster Table 










Monster name 


Ogre 


Bats Ghost 


Clam 


Ice 


Bones 


Monster number 


24 


21 


23 


20 


36 


22 


Revi/ard 


Gold 


Chest 




Pearl 


Lamp 




Revi/ard number 


26 


25 





27 


28 





Move delay 











1 


1 


1 


Move increment 


2 


4 


6 











Attack count 




















Kill probability 


60 


60 





90 








Steal all probability 


30 


40 





60 


60 





Steal ovi/n probability 


55 


90 





65 








Home room number 


14 


16 


17 


18 


12 


15 


Life force quotient 


100 


40 


50 


60 


25 


75 




Weapon Table 










Weapon name 


Ax 


Bomb 


Fire 


Knife 


Light 


Ice 


Weapon Number 


15 


16 


18 


19 


33 


36 


Power 


100 


150 


30 


50 


30 


40 


Attacks Monster No. 1 


24 


24 


21 


24 


23 


21 


Attacks Monster No. 2 




22 


22 


20 






Attacks Monster No. 3 




36 


36 









Program Flow 

Initialize - 30000's 

Dimension and set up data for nouns, 
verbs, noun types, verb types, status or 
location of nouns, noeth, south, east 
and w/est tunnel connections, monster 
life force tables, and w/eapons table. 

Output • 4000's 
Print room descriptions, possible exit 
directions, and room contents as well as 
your possessions. 

Input/Decode - 1000's 
Read your typed-tn command, select 
each word and scan it against the noun 
and verb lists.The first valid noun and 
verb are edited and used to control the 
rest of the program. 

Actions ■ 2000's 
This routine handles takes and puts, 
special verbs and nouns, your attacks 
on life forces, and movement through 
the caverns. 

Reactions - 3000's 
The demonic life forces who have been 
attacked or who do not have their own 
treasures fight back. Based on complex 
probabilities, they either kill, steal your 
treasures, or wander the caverns in 
search of you. 



Microbes 



Move It: Relocating PET Source 

Programs and Object Code 

Herman, 16:17 



I 
Th4 following tabPe shoirtd have ap- 
peejred with Harvey B. Hermarr's article 
m rjtiCRO 16:17 MOVE (T _. 



AIM-65 in the Ham Shacic 
De Jong, 16:29 

The foliowrng table should have ap- 
peared with Marvin L. De Jong's article. 
11 is a table of ASCII to Morse code look- 
' ups which fs used by the "Ham Shack" 
program. 



1. 
2. 
3. 
4. 

5. 
6. 
7. 
8. 
9. 
10 



Operation 

Load "MONITOFi'' and rewind 
SYS 62894 
SYS 1039 
M 027B, 027B 
027B 00 04 6B 07 . . 
027B00 1C6B 1^^... 
X 

SYS 62403 I 

POKE 135,28 

LOAD "MODIFY" and RUN 
LOAD "MONITOR " and RUN 



I 



Comment ' 

Seta up PET PAI^METERS 
Load tape header 
■ Run Monitor 
Display tape address 

Change addresses 
Return to BASIC 
Finish monitor move 
Protect relocated monitor 
Run BASIC MODIFY program 
Run MONITOR program to finist 
relocation 



Figuce 1: Monitor Relocation Procedure 



_ 


C-'J-. 


^ 


• __ 


- T- 


_ — 


: 


e.33 7' 


"•" 


—r- 


~" ~ 


- .~ 




e-?:- 


~_ ~ 


-34 


^ — 


.' — 


. 


-r--I*I'r 


— "*■ 


Z" ^ 


' - 


~" ~ 




C-5I I 


"ir""- 


Z^-_ 


j-r- 


— - 


. 


0-J4.-J 


~ "1 


— Ji 


z z 


-•'z 


. 


-Z-t?-- 


~-S 


-T ■:_" 


— ~ 


"" T* 


. 


C-?iE 


-IE 


:-■ 


rji 


E"-" 


. 


-I- -3 -I 


- r 


EC 


■^r' 


F^ 


, 


-r v ^ -I' 


■ZD 


_.''z 


— .1 


- ". 




."^ii-jT-i 


10 


3 


1 ^ 


I »■_' 


. 


C^tE 


.-E 


— z 


- Z' 


Ce 



>LIST 

e REM SPELUHKER I 

1 GOTCi imm-. REM TO IHITIflLIZE 
leee print "?".;: input IN-I-;IN*< LEN(IN$:;'+1> = " go N t- ":I=1 
1065 NOL1N=0 : VERB=0 

1010 GOSUE 1500: GOSUB 1660: GOSUB 1700 
1020 IF W2$#"* " THEN 1918 
1050 NT VP=NTVP •; NOUN ) : VTVP=VTVP ( VERB > 
1660 IF (VTVP MOD ';NTVP+2>»=NTVP THEN 2666 
1070 PRINT "ICH VERSTEHE MIGHT" 
10S6 GOTO 3606 
1206 GOTO 2000 
1500 W3*="":S=0: FOR 1=1 TO LEN(IN$>: IF 5=6 THEN 1526; IF IN$(LI)=" " THEN 

1580: IF S=5 THEN 1566: GOTO 1546 
1520 IF IN$(I.. I) = " " THEN 1569 
1540 S=S+l:lO$(S> = IH$(L D 
1560 NEXT I 

1580 IF S<5 THEN W3*(S+1>=SPC*';;S+1) 
1530 RETURN 
1600 IF -NOUNttO THEN RETURN : FOR .1=1 TO HUMN: IF W3-.r#N0UNSJ':.J*5-4.. J+-5) THEN 

NEXT J: IF .J>=NUMN THEN RETURN : NOUN=.J : W2i=W3$ 
1610 RETURN 
1700 IF VERB#6 THEN RETURN : FOR J=l TO HUMV : IF W3:t#VERB'3*(..T+5-4.. .J*5> THEN 

NEXT J: IF J>=NUMV THEN RETURN : VERB=.J : W1$=W3J- 
1710 RETURN 
2000 REM MOVE 
2010 NL0C=6 

2020 IF N0UN>8 THEN 2260 
2036 IF <NOUN MOD 2>=1 THEN 2196 
2040 IF L0C#11 AND LOCttS THEN 1676 
2100 GOTO 210e+NOUN*10 
2110 NL0C=N'::L0C>: GOTO 2196 
2120 NLOC=0: GOTO 2196 
2120 NLOC=EaOC.): GOTO 2196 
2146 NL0C=15: IF LOC=S THEN NL0C=8: GOTO 2196 
2156 NLOC=SaOC> : GOTO 2196 

2166 NL0C=22: IF L0C=8 THEN NLOC=S; GOTO 2196 
2170 NL0C=W';L0C> : GOTO 2190 
2180 NL0C=12; IF LOC-S THEN NLOC:=S; GOTO 2196 
2190 IF RFlFT=l THEN NLOC= f\BS, (NLOO 

2191 RRFT=0;PLOC:=LOC 

2192 IF NL0O6 THEN LOC:=NLOC 

2193 IF NL0C.#12 THEN 2966 

2194 IF M':;50><5 THEN 2966 

2195 IF PLnc=6 THEN S<12>=6 

2196 IF PL0C=11 THEN W(12>=e 

2197 GOTO 2906 

2200 IF (N0UN=9 OR NOUN=10> AND ROPE=0 THEN GOTO 1670 
2205 IF N0UN«9 THEN 2256 
2210 IF L0C»5 RND L0C»13 THEN 1676 
2220 IF L0C=5 THEN L0C=4 
2236 IF L0C=13 THEN LOC=50 
2240 GOTO 3000 
2250 IF NOUN«10 THEN 2306 
2260 IF L0C.»4 THEN 1670 
2270 L0C=5; GOTO 3006 

2300 IF VERB=S OR VERB=11 THEN 2326; GOTO 2350 
2320 IF NUMP=8 THEN 1070 

2325 IF N0UN=24 RND (L0C=19 OR LUC=10 OR L0C=5 OR L0C:=18 OR L0C=7 OR LUC= 
6 OR L0C=11> THEN 2345 

October, 1979 MICRO ~ The 6502 Journal 17:19 



2330 IF STH(N0IJtO#L0C THEN 1079 

2335 IF N0UH=2y HND t1<50)>0 THEN 1070 

2345 STh(NijUN)=-1; GOTO SOOO 

2350 IF VERB=y OR VERB=10 OR VERB=14 THEN 2370; GOTO 2400 

2370 IF STh<N0UN>#-1 THEN 1070 

23S0 STflaCilJN)=LOC 

2383 IF N0UN#33 THEN 2420 

2335 IF VERBttlO THEN STfl<33:>=0 

2387 LIGHTER 

2390 GOTO 2420 

2400 IF VERB#12 THEN 2900 

2410 IF STH(NOiJN:J#-l THEN 1078 

2420 FOR WT=1 TO NUMW+5-4 STEP 5 

2425 IF NOUN#WT'::UT;' THEN 2480 

2430 FOR D=2 TO 4 

2435 IF (STh<WT(WT+[;0> MOD 100)#LOC THEN 2470 

2440 FOR M=l TO NLIt'1M*10-9 STEP 10 

2445 IF WT':WT+D)#t-1(M;' THEN 2468 

2446 HT= RND (WT(WT+1>)/(CIJRSE+1 :■ 

2448 H(M+9:)=t'KH+9:;'-HT 

2449 IF M'::M+4>=0 THEN Hai+4>=1 

2450 PRINT "flSSRULT ON "j N0UNS$(h(M:'*5-4, f'KM) t:5>.; ".. ".HT;" UNITS" 
2452 PRINT "ITS LIFE FORCE IS NOW "; M<h1+9::'; "V:" 

2455 IF !1(M+9)>0 THEN 2460 

2456 PRINT N0UNS$(Mai:)*5-4.. H(H)*5); " HRS BEEN ELIMINftTED" 

2457 STfl';t1<M)>=0 
2460 NEKT H 
2470 NEXT D 
2480 NEXT WT 

2490 IF N0UN#16 OR VERB=10 THEN 2506 
2492 STh(16:j=0: GOTO 2493+ RND <A') 

2493 N<LOC>=0: GOTO 2586 

2494 E( 100=0: GOTO 2500 

2495 S''.LOC>=0: GOTO 2580 

2496 W<LOC->=0 

2500 IF NTVP#32 THEN 2988 

2510 IF N0UN#33 THEN 2520: IF VERB=12 THEN LIGHT=1: GOTO 2908 
2528 IF N0UN#29 THEN 2530:RhFT=1; GOTO 2908 
2538 IF NOUN#30 THEN 2548:R0PE=1: GOTO 2988 
2548 REM 

2980 IF N0UN<11 THEN ROPE=0 
2910 IF STfl':30>=LOC: THEN R0PE=1 
2920 IF L0C=12 THEN 3088 
2938 l'K12;'=6:S'::i2;'=ll 
3068 REM RE-RCTION 
3010 FOR M=l TO HLIMM+-10-9 STEP 18 
3020 IF STfl(M<M)>tt0 THEN GOSUB 3888 
3030 NEXT M 

3048 IF STfla5>=8 AND STfla4>=2 THEN STfl(35> = 2 
3:090 GOTO 4886 
3St30 REM MONS SUB 
3802 MRM=STHai':M>> MOD 188 

3810 IF (STfKn(M+l)> MOD ie0>=MRM HND M(M+4)=0 THEN 3988 
3820 IF MRM=LOC THEN 3868 
3830 M(M+2>=(;MCM+2>+M(M+3)> MOD 6 
3848 IF M(M+2)#8 THEN RETURN 
3345 GOTO 3858+ RND (4) 
3858 NLOC=Nc;MRM> : GOTO 3855 

3851 NL0C=E<;MRM>; GOTO 3855 

3852 NLOC^SCMRM) : GOTO 3855 

17:20 MICRO — The 6502 Journal October, 1979 



3853 NL0C=W';HRM); GOTO 3855 
3S55 IF NL0C<1 THEN RETURN 
3353 STfl(M(M>:)=NL0C+STRi:M';M)>-MRt1; RETURN 
3360 n(t1+4>=Mai+4>+l 

3365 KP=<M(M+5>-';STfi(N(M+l))=-i;'*40+y*(ri'::h+4)-2))*M(H+9)/lO0+CURSE 
3866 IF KP>60 THEN KP=60 

3370 SHP=';N';M+6)+9*(t1(M+4)-2);'*M';H+4),-'100+CURSE 
3871 IF SflP>70 THEN ShP=70 
3375 SRP=(M(;M+7;>+9+';r'KM+4)-2>)*Mai+9),-'100+CURS: 

3876 IF SRP>S0 THEN SRP=30 

3877 PRINT "RTTfiCK BY " ; N0UNS*((M';[1)-1)*5+1. Mri>*5) 
3379 Rl== RND a00):R2= RND (100):R3= RND (100) 
3SS0 IF KP>R1 THEN 3920 

3885 IF SflP>R2 THEN 3940 
3SS7 IF STfla'Kr'1+l>>#-l THEN RETURN 
3890 IF SRP>R3 THEN 3960 
3895 RETURN 

3900 STfi(M<ri;o=h(:M+s> 

3905 STH';r'1(M+l)>=M(H+8) 

3910 RETURN 

3920 VTRB 23: TRB 1; PRINT "THE "; NOUNS*'; (H^M) -1>*5+1.. ri(h>+5)i " KILLED VOU'" 

3924 PRINT KP. Rl 

3925 END 

3940 FOR 1=1 TO NUtIN 

3945 IF NTVPa>=16 RND STR(I>=-1 THEN STRa>=M(H+8) 
3950 NEXT I 

3957 PRINT "ALL VOUR REWRRDS STOLEN" 

3958 PRINT SAP. R2 

3959 GOTO 3900 

3960 PRINT "HE TOOK BACK HIS VflLURBLE" 
3962 PRINT SRP. R3 

3965 GOTO 3900 

4000 REM OUTPUT 

4020 FOR 1=3 TO 9: VTRB I: TRB 2; PRINT " ".; : NEXT 

I 
4050 IF LOCCl OR LOO50 THEN GOTO 4051 
4660 GOTO 4000+i00+LOC 
4070 POKE 50.. 63: VTRB 3: TRB 2: PRINT LOC*.; : POKE 50.. 255; PRINT " "; RETURN 

4090 VTRB 23: TRB 1 

4095 IF LIGHT=1 OR L0C<3 OR L0C.=i9 THEN 9100 

4697 PRINT "IT IS VERV DARK" 

4099 GOTO 9100 

4100 LOC*=" MOUTH ": GOSUB 4070 

4199 GOTO 4090 

4200 LOC$="TREE ROOM " : GOSUB 4070 

4299 GOTO 4090 

4300 LuCI-=" WRITING ROOM": GOSUB 4070 

4399 GOTO 4090 

4400 LOCt="PIT ": GOSUB 4070 

4499 GOTO 4090 

4500 LOC$=" SOUTH LAKE ": GOSUB 4070 

4599 GOTO 4090 

4600 LnC*="WEST LAKE ": GOSUB 4070 

4699 GOTO 4090 

4700 LOC$=" NORTH LAKE ": GOSUB 4070 

4799 GOTO 4096 

4800 LOC$="MAZE ROOM ": GOSUB 4070 
4399 GOTO 4090 

October, 1979 MICRO — The 6502 Journal 17:21 



4900 LCiC:|:=" FROZEN RIVER": GOSUB 4076 

4999 GOTO 4090 

5000 LOC|:="RIVER ROOM " : GOSUB 4070 

5099 GOTO 4090 

5100 LOCt="HUB ROOM " : GOSUB 4070 

5199 GOTO 4090 

5200 LOC*="Ii::E ROOM ". GOSUB 4079 

5299 GOTO 4090 

5300 LOC$="C:HIMNEV ": GOSUB 4070 

5399 GOTO 4090 

5400 LOC.$="GOLD ROOM ": GOSUB 4070 

5499 GOTO 4090 

5500 LOi:.$=" BONES ": GOSUB 4070 
5510 IF STft<35)»-l THEN C.URSE=CUR.SE+15 

5599 GOTO 4090 

5600 LOC*="BflTS ": GOSUB 4070 

5699 GOTO 4090 

5700 LOC.*=" GHOST ROOM ". GOSUB 4076 

5799 GOTO 4090 

5800 LOC$="MISTV LRKE ": GOSUB 4070 

5899 GOTO 4090 

5900 LUC*=" SWIFT RIVER ": GOSUB 4070 

5999 GOTO 4090 

6000 LOC$=" INTERSECTION"; GOSUB 4070 
GQ99 GOTO 4090 

6100 GOTO 6000 
6260 GOTO 6000 
6999 GOTO 4090 

8900 LUC$-="0VER FALLS ": GOSUB 4070 
8910 VTRB 23: TAB 1: GOTO 9090 
9000 L0C$="YOUR HOME " : GOSUB 4070 
9005 flMT=0 

9010 IF STfl'::25;'=-l THEN flMT=RMT+13 
9020 IF STH'::26>=-1 THEN flMT=flMT+22 
9030 IF STfl(27>=-l THEN flMT=flMT+8 
9040 IF STRC2y;;'=-l THEN RMT=fiMT+5 
9050 VTRB 23: TRB 1 
9060 IF RMT=0 THEN 9090 

9070 PRINT "YOU HftVE FOUNO $"; RMT; ".. ".; RND ( 900;' +180; " IN TRERSURES" 
90S0 IF RMT>13 THEN PRINT "NICE SPELUNKING!" 
9090 PRINT "GOOD-BVE" 

9099 END 

9100 FOR 1=2 TO 10: VTRB I: TRB 30; PRINT " "; NEXT I 
9105 IF LIGHT=0 RND L0O2 RND L0C»19 THEN 9290 

9110 VTRB 5; TRB 33: PRINT "-" ; TRB 33; PRINT " + " ; POKE 50.. 63 

9140 IF N':;LOC)=0 OR (HaOCXO RND RflFT=0> THEN 9150; VTRB 3: TRB 33; PRINT 

"N": TRB 33; PRINT " " 
9150 IF S';LOC::'=0 or (SaOCXO RND RRFT=0;' THEN 9160: VTRB S; TRB 33; PRINT 

" "; TRB 33; PRINT "S" 
9160 IF E';:LOC;'=0 or CE'XOCX© RND RRFT=0> then 9170; VTRB 6; TRB 35: PRINT 

" E" 
9170 IF W';;LOC;)=0 or (W<LnC><:0 RND RflFT=0> THEN 9130: VTRB 6; TRB 30; PRINT 

"W " 
9180 IF ':.L0C=5 OR L0C=13> RND R0PE=1 THEN 9185: GOTO 9190 
9135 VTRB 2; TRB 33: PRINT "UP" 
9190 IF L0C»4 OR R.OPE^O THEN 9200 
9195 VTRB 10: TRB 33: PRINT "DOWN" 
9200 IF L0C=11 OR L0C=8 THEN 9210: GOTO 9290 
9210 VTRB 3: TRB 30; PRINT "N ": THB 30: PRINT " W" 
9215 IF L0C.»8 THEN 9220: VTRB 3; TRB 35: PRINT " E" : TRB 35; PRINT "N " 

17:22 MICRO ~ The 6502 Journal October, 1979 



9220 VTflB 8; TAB 36: PRINT " W; : TAB 35: PRINT "S " : TAB 30: PRINT "S ".; 
: TAB 35: PRINT " E" 

9290 POKE 50.255 

9300 IF LIGHT=0 AND L0O2 AND LCiC#19 THEN 9406 

9305 VTAB 5: TAB 2:J=0 

9310 FOR 1=1 TO NUMN-1 

9320 IF (STH(I) MOD leS^ttLOC THEN 9360 

9330 PRINT N0UNS$(<I-1)*5+1. I*5>; " ":■ 

9340 J=<.J+1) NOD 4: IF J#0 THEN 9360 

9350 PRINT ""; TAB 2 

9360 NEXT I 

9400 VTAB 13: TAB 2: FOR 1=1 TO 12: PRINT " ".; : NEXT I 

9410 VTAB 13: TAB 2: PRINT "POSSESSIONS "; :NUMP=0 

9420 FOR 1=1 TO NUt1N-l 

9430 IF STA(;i)>=e THEN 9480 

9440 PRINT N0UNS$(a-l)*5+l. I*5)j " "; 

9450 NUMP=NUMP+1 : IF NUt1P=4 THEN TAB 14 

9480 NEXT I 

9900 VTAB 23: TAB 1: GOTO 1000 
30000 REM INITIALIZE ROUTINE 
30010 DIM IN$<40;j. N0UNS*<255). VERBS* (255),. Wl$(5>.. W2*(5). W3$<5>. NTVP';50>. VTVP'; 

50 >. STA<50) 
30020 DIM N(50).E(50).S(50).W<50) 
30030 TEXT : CALL -936 

30040 D I M LOC$ ( 26 ) . SPC$ < 5 ) , POSS < 10 ) .. M < S*10 > 
30050 SPC:$=" 
30060 NUMW=6 
30065 DIM WT(5*NUMW) 
30070 L0C=1 

3v3i00 REM INITIALIZE VARIABLES 
30101 REM SHOULD BE READ AND DATA STMTS 
30110 NOUNS*'; LENC NOUNS* >+l>="N NE E SE S SW W NW UP DOWN 

II 

30120 NOUNS* < LEN ( NOUNS* >+l>=" CAVE LAKE RIVERTREE " 
30130 NOUNS*';: LEN';N0UNS*>+1> = "AX bomb CURSEFIRE KNIFE" 
30140 NOUNS*'r. LEN':;NOUNS*)+i;i="CLAM BATS BONESGHOSTOGRE " 
30150 NOUNS*':; LEN';N0UNS*)+1;'="CHESTG0LD PEARLLAMP " 
30160 NOUNS* 'r LEN ': NOUNS* >+lJ=" RAFT ROPE TENT TRUCKLIGHT" 
30170 NOUNS*'; LEN';; NOUNS* ;'+i;:' = "WATERAPPLE ICE " 
30195 NOUNS* ': LEN (. NOUNS* > +1 > = " ***** " 
30199 HUMN=37 

30210 VERBS*( LEN ';; VERBS* >+i::' = " GO JUMP RUN WALK DRIVECLIMB" 
30220 VERBS*'; LEN';VERBS*)+1> = "DIG " 

30230 VERBS*'; LEN'::VERBS*::'+1> = "CARRVDR.0P PUT TAKE USE WISH THROW" 
30240 VERBS*'; LEN 'J VERBS* )+i;' = " HELP KILL STOP HIT FIGHT" 
30250 VERBS*'; LEH';VERBS*;'+1> = "RUB " 
30260 VERBS*(; LEN';VERBS*>+1:'="STARTDRIVE" 
30270 VERBS*< LEN(VERBS*)+1>="DRINKEAT BITE " 
30295 VERBS*( LEN<VERBS*>+1)="**+**" 
30299 NUMV=26 

30310 FOR 1=1 TO 10:NTVP';i>=l: NEXT I 
30320 FOR 1=11 TO 14:NTVP<I>=2: NEXT I 
30330 FOR 1=15 TO 19:NTVPa>=4: NEXT I 
30340 FOR 1=20 TO 24:NTVP';i>=S: NEXT I 
30350 FOR 1=25 TO 28:NTVP';i)=16: NEXT I 
30360 FOR 1=29 TO 33:NTVPa>=32: NEXT I 
30370 FOR 1=34 TO 35:NTVP(;i;'=64: NEXT I 
303S0 NTVP';36;'=32 

30410 FOR 1=1 TO 6:VTVP';i)=l: NEXT I 
30412 VTVP '; 2 > =11 : VTVP '; 6 ) =3 
October, 1979 MICRO ~ The 6502 Journal 17:23 



30420 

20420 

304:<2 

30440 

20442 

20450 

20460 

20470 

20500 

30510 

30520 

30530 

20540 

30550 

30560 

30570 

205S6 

30600 

20610 

20620 

30630 

30640 

20650 

30666 

30670 
306S0 
30690 
20700 
30710 

30720 
30730 

30740 

20800 
30S10 
30S20 

30830 
30840 

30850 
30860 
30890 
30900 
30910 
30920 
30930 
30940 
30950 
20999 
31999 
32000 



VTVF(7)=2 

FOR 1=8 TO 11:VTVP<I>=116: NEXT I 
VTVP';i2>=36:VTVPa3)=36;VTVP(14>=4 
FOR 1=15 TO 19;VTVP(I)=8: NEXT I 
VTVP<17>=40 
VTVP(20>=ie 

FOR 1=21 TO 22;VTVPa>=32; NEXT I 
FOR 1=23 TO 25:VTVP'::i)=64: NEXT I 
FOR 1=1 TO 14:STfla::'=0; NEXT I 
STfl'::i5>=4;STfl<16>=3;STfl(17)=15 
STR>;18>=13 : STfldgj-l : STfl(20>=18 
STfl(21>=16 : STFl';22)=15 : STfl(23)=17 
STfl';24>=14:STH':;25;'=16;STfl<26>=14 
STfl';27 >=18 : STH':28>=12 : STH(29>=5 
ST R ■:; 30 > =9 : ST fl ( 31 ':> =1 : STfl ( 32 > =1 
STfl':33)=l;STH':;34;'=0;STR'35)=0 
STh(36>=12 

FOR 1=1 TO 50:N<I>=0:E(I>=0:Sa>=0:Wa)==0: NEXT I 
N';;i>=50:N(3)=2;N<5>=-lS:N(7>=9;N<S>=S:N';9)=7 
N<10)=3 ; Nai)=13 ; N<16>=22 : N<18)=7 
H<19>=1 : H(20)=8 : N(22>=11 

E':;2>=l;E(4>=20:E(6)=-lS;E';3)=9;E(9>=l:E';il>=14:E(17)=21:E(:20)=3 
E';2i>=ll 

S';;i>=19:S<2;>=2:SC2>=10:S(7)=-i8:S';S>=S;;Al0:J=-ll:S':ll)=-49:S';i2)=ll: 
SC12>=ll:S(;i8>=5 
S(21)=22:Si;22>=16 

U<1>=2 : W<3>=20 ; WC6)=12 ; W(8)=20 : W(9)=8 : W';il)=21 
W'::i2>=6 ; W(14>=11 : W<15)=11 : W(13>=6 : W(20> =4 : W<21)=17 : W';22)=21 
POKE 50.. 62 

VThB 24: GOSUB 31999: VTflE: 1; GOSUB 319:^9; VTflB 11: GOSUB 21999: VTflB 
16: GOSUB 21999 
VTflB 2: TAB 1 

FOR 1=2 TO 22: PRINT " "; : TAB 29; IF i:il THEN PRINT " "; : TAB 39: PRINT 
" ": NEXT I 

POKE 50.255: POKE 22.1: POKE 23.27: POKIi 24.16: POKE 25.23: VTflB 17: 
TflB 2 
FOR 1=1 TO 60:Ma>=0: NEXT I 



Ma>=24:M';2>=26:M(:4>=2:M':;6>=60:M(7)=20:l1(8> 



: M ■:; 9 ) =14 : M <'■. 10 > =100 



M(ll>=21 : n';:i2)=25 : t1(14>=4 : M'::i6>=60 : M(17 '=40 : tldS :'=90 : tlc;i9)=16 : MC20.) = 

40 

M ( 21 > =22 : M •.•; 24 ) =6 : M (. 29 ) =17 : M ( 30 > =50 

M<3i;'=20:Ma2>=27:n(33>=l:tia6:)=90:M<37»=60:Ma8>=65:M<39>=18:t1';40) = 

60 

M •; 41 ) =36 : t1 < 42 > =28 : M •; 43 ) =1 : M ( 47 > =60 : M < 49 > =12 : M (50 > =25 

M';51>=22 : t1(:53>=l : M(59>=15 : M':60 )=75 

NUnM=6 

WTa)=15:WT(2>=100:WT(2>=24:WT(4>=0:WT':;::i>=0 

WT ( 6 > =16 : WT ( 7 > =150 : WT ( 8 ) =24 : WT ■. 9 ) =22 : WT ;; 10 ) =26 



WT(;i4>=22:WT':;i5)=36 
WT ( 19 ') =20 : WT ■; 20 ) =0 
WT(24>=0:|.JT':;25>=0 
WT(29>=0:!'JT(30>=0 



WT(11)=13 : WT(12>=30 : W\(.lS>=21 : 

WT'::i6:;'=19 : WT<17>=50 : WT';:iS)=24 : 

WT '■ 21 ) =33 : WT (. 22 > =30 : WT ( 23 > =23 : 

WT '.; 26 ) =36 : WT ■; 27 > =40 : WT ': 28 > =21 : 

GOTO 4000 

TflB 1: PRINT " "; : RETURN 

PRINT •: PEEK <202)+ PEEK •;:203>*256)-':: PI-.EK (204)+ PEEK (265>*256> : END 



17:24 



MICRO — The 6502 Journal 



October, 1979 



The COMPUTERIST Has It All !! 

The leaders in Expansion Accessories for 

AIM / SYM / KIM 

Featuring a Power Supply/Enclosure for the AiiVI 65 



mm \^M}^ 



tm 



Now with - 
OVER-VOLTAGE and 
SHORT-CIRCUIT 
Protection 



ENCLOSURE 

WITH BUILT IN 

POWER SUPPLY 

SPECIFICATIONS: 

INPUT: 11 0/220 VAC 50/60 Hz 

OUTPUT: +5V@5A 

+ 24V@ 1A 
GROUNDEDTHREE-WIRE LINE CORD 
ON/OFF SWITCH WITH PILOT LIGHT 
Enclosure has room for the AIM and one 
additional board: MEMORY PLUS or VIDEO PLUS 




AIM ENCLOSURE: 
$45°° 

AIM PLUS: $110°° AIM and AIM PLUS: $485°° 



Plus some very elegant expansion boards 



AIM/SYM/KIM 




MEMORY PLUS: $20000 



8K STATIC RAM po°*p 
Sockets for 8K Eprom 
6522 1/0 Port 

ON BOARD REGULATORS 

EPROM 
PROGRAMMER 

FULLY ASSEMBLED AND TESTED 



m\^\^(^ \I^im^'"^o. AIM/SYM/K.M 




UPPER/fowef case ASCII 

128 Additional User Programmable 

Characters: CRAPHICS- 

SYMBOLSFOREIGN CHARACTERS 
Programmable £>creen Format up to 

80 CHARACTERS ■ 24 LINES 
KEYBOARD and LIGHT PEN Interlaces 
Upto4KDISPLAiYRAM 
Provision lor 2KEPnCM 
Provision to add 6502 for 

STAND-ALONE SYSTEM 

ASSEMBLED AND TESTED 

WITH 2K DISPLAY RAM 

VIDEO PLUS: $245''<' 



Many other products available. Write for a complete catalog 
[or call if you are in a hurry !] 



The prices listed above do 
not include shipping and handling. 




PO Box J 
S Chelmsford, mfl 1 8*2^1 

ai7/23a-3»49 




Classified Ads 



CHALLENGER IP OWNERS Triad of 
24X24 grapfiics' S40 worth of com- 
ponents will i.i"0'i«4lt- yu'.T vicibC display 
to give 30 iinfs X SO ■^iiardU-ris on 
screen and driiiljl*' vour pr.icesbor 
speed. Comole'-J 'nftwar*' an.) -jtep fiv 
step fiardwar-' m I'.'ifir.it.c n'j trir onlv 
$8.00. Conta- ' 

S. Chalfin 

905 ClinK'Ji Si 

PhlladeU'hii f'* Vin,' 

PET LANGUAiJt MACHIN'E GUIDE 
comprehensi'" 'iinnu.n U- .iid tnt 
machine lariiju.ii;- f rri ;rrin.inpf Mure 
than 30 routi"t" .-.>■- fii I'. i:r-t3iii-ii -.u 
that the reacifr i i; tut "lii-:!! tr. u'-- iiii 
medlately.Sf'.if. ''i-l "i rif*- POMh 
$6.95 plus ■'■■ '•■■ p. I !■.:• Vrn c-r 
Mastercharg- .u c.'i'ti i1 .V. 'i-. LjilK 
guarantee (liT ii.'iv.; f.'i-'t-ii t 

ABACUJ. sor^iVARl 

P.O. Bo> "211 

Grand RrtLiK '." 4>Jf.10 

WANTED DisK jpfnUii-j s,' ifi'i hjr'l- 
ware and scflAirc lor u .■- «itn IfiK 
SYM-1. Contc.' • 

Kenneth '• t'i"l .tein 

341 West ''I'-T birect 

NewYorl-.H" H'02o 

SYM-1 0WN = rlV-'.^^M.Kl\1 Ap(i"i'!'- ti- 
First Book (t K'M JetdM:- ch.iiigfs !■> 
KIM games r.ir- uri HA^-IC SYM I 
Changes sh' a'i Ii'io s'v l^n.* l'>'i'l 
modify, and 'iJi' A;i[i''ndi\ '"liy S4 F"si 



\ 



Bool< of KIN' Sy ■ 'niU-, 
postpaid. Or-i:'' f'.'m 

Robert A P-ri- 

P.O.B0X .'2.1 1 

SunnyvEl-.- CA 9408/ 



For only $33 for 12 issues you get- 
CURSOR. the original magazire for the 
Cninniodor? PET Each issuj has a 
yrdphii. 'Front Covei" program plus five 
excellent programs that are ready to 
Load and Run The CURSOF NOTES 
nt'ASlettpr Aith each issue provides 
usetui information about the programs, 
ab v^Gll as he'p ci- using your F'ET Con- 
tact- 

CURSOR 

Bu-. L<50 

Goieta. CA 93017 

SUPER a K HORSERACE Up tc ton peo- 
pl-j Tjn 'jfi to the track and bet <■ n d dit- 
ti'rent horses ►sacn race Ever ' racf- is 
new. v.ith gr.?['hics and soutiJ. Best 
cniiii- (■! this tv[ir- On . ,is.sotl& '01 an 8K 
APPLE II for 'nl/S9.95 Contait. 

Tini Di'*li' g 

^2A~y Easl.h'.v Drive 

Tucson A? B571U 

APPLE PET ATARI salespersons no^jft- 
od throughout the world WorK for com- 
mis«iion!. Sf-nd resume to RiCruitmo 
D.i!-i.. COMPUTERWORLD Inc . 

t 'o Cumyuter Ccniponjnts nf 

Orarige County 

6701 "Acstminster Ave 

Vi/.-'-.tminst"! CA 92h63 

(JPllMIZt APPLESOFT prjgrams 
jhort-.n variatilij names removf remarks 
and >.-iitra i.olons, Cuncatcnate lines, 
reritjniber, Irst varrat'le ''loss-ra urenci'S 



iis.rn Si250 i2i1 ■)Kp'ijyraniSfin(1c;-48K)AI'PLEII s 
Casettr- $15 drsk S20 from 
SonsrbIc Software 
PO B(><2395 
Drarnorn. Ml 4812J 



NEW BOWLtNG PR06RAM.F0B APPLE- 
brie to four pfayers compete lit a stan- 
dard tiowUng game. Challenging game 
with exceflent quality APPLESOFT pro- 
gram Cassette $9.95. Order f rom: 

C E.Howerton 

125 Marcelta Road 

Hampton. VA 23666 

"STAR TREK- for your OSl Challenger IP 
or Superboard 11, needs 5K RAM. Runs in 
machine language. Very fast anJ tough 
to belt S'iml cher:k o' money order inr 
S12 95 to 

David Vap't Hot 

RR1 

Hosptirs, lA 51238 

Advertising Softw.'in; for APPLE- 
S25 bu-.-, SCROLLING WONDER GIANT 
LETTER, and HI-HE£. ALPHANUMERICS 
on cassette, 1>3kb $25 buys MULTI- 
MESSAGE with INTERLEAVED 
KALEIDOSCOPE, and MULTl MESSAGE 
with INTERLEAVED ABSTRACT ART on 
cassette. 32kb 
Send check or monoy order to 

CONNECTICUT INFORMATION 

SYSTEMS 

21a Huntington Hd 

Btidgepoit. CT 06608 

QUALITY SOFTWARE for the PET 
Cheqiie-Chei^k (best bdl.-mceri $r95, 
Metrrc-Calc iRPN. with converiionsi 
$7.95. MenoEAplorer ilearn PET details) 
$7 95. BiMboard 1 Times Squaie" 
nitis^agu of clioicel S49.95; Soiid check 
or monev order to 

MICRO SOFTWARE SYSTEMS 
Dept MS79, P.O Box 1442 
Woodbndge VA 22193 
VA res add 4" 1 tav. 



iMaQQQii 



REAL GRAPHICS FOR PET 




SHOWN WITH: 
K-1007-1 INTERFACE 
K-1008-P VISIBLE MEMORY 
K1005-P 5 SLOT CARD FILE 
K-1008-3C DRIVER SOFTWARE 



$99.00 

$243.00 

$80.00 

$20.00 



CALL OR WRITE FOR OUR FULL LINE CATALOG OF PET 
EXPANSION PRODUCTS, 



• THE FLEXIBILITY YOU HAVE DREAMED ABOUT IS NOW AVAILABLE! 

• 320 WIDE X 200 HIGH ItESOLUTION 

• EACH DOT INDIVIDUALLY ADDRESSABLE 

• SOFTWARE SUPPORT - LEVEL 1 GIVES GRAPHICS & TEXT CONTROL AT MACHINE 
LANGUAGE SPEED BUT ACCESSABLE FROM BASIC BY GOSUB AND VARIABLE 
STATEMENTS. 

• DUAL PORT 8K BYTE MEMORY ON BOARD ALLOWS FULL USE OF MEMORY FOR 
OTHER TASKS (SEE YOUR PROGRAMS IN THEIR DIGITAL FORM IF YOU LIKE!) 

• DOUBLES THE MEMORN SIZE OF AN 8K PET 

• COMPLETELY TRANSPAi^ENT SCREEN REFRESH - NO SNOW OR BLINKING EVER - 
THE PROPER WAY TO D3 IT! 

MICRO TECHNOLOGY UNLIMITED 

841 GALAXY WAY 

PO BOX 4596 

MANCHESTER, NH 03108 

(603) 627-1464 



6522 Timing and Counting Techniques 



While many 6502 computerists are becoming familar 
with the 6522 Versatile Interface Adapter, do you really 
know how all of it features work or how to use them? 
This tutorial will clear up the mysteries of the 6522. 



Marvin L. De Jong 

Department of Math and Physics 

The School of the Ozarks 

Point Loolcout, MO 65726 



Applications that recjuire interval 
timers include everything from the pro- 
duction of simple sound effects for 
games to the implementation of 
sophisticated data logging or control 
processes. Because single-chip micro- 
computers, such as the Rockwell 6500/1 
and the Intel 8048, are intended for high 
volume, low cost applications, the fact 
that they include counter/timer logic is a 
testimony to the importance of 
counter/timer functions for a large var- 
iety of applications. Several simple ap- 
plications will be explained. 



The techniques will focus on the 
counter/timers found on the 6522 Ver- 
satile Interface Adapter. The 6522 is 
currently popular in a number of micro- 
computer systems that utilize the 6502, 
including the SYM-1, the AIM 65, and the 
MICRO PLUS. Expansion boards such as 
the MEMORY PLUS also include the 
6522, and the 6522 can be easily inter- 
faced to the popular KIM-1 (see 6502 
User Notes, No. 13, pg. 16). However, the 
techniques that are described will fre- 
quently be applicable to any 



counter/timer with only minor modifica- 
tions in the hardware or the programs. 

The basic features included in many 
counter/timers (also called interval 
timers) are shown in Figure 1. This block 
diagram shows that a counter/timer con- 
sists of three registers; the counter 
register which is either an 8-bit register 
or a 16-bit register, a flag register, and a 
control register. A number, N, is loaded 
into the counter register by a WRITE 
(typically an STA) instruction. If the 
counter is a 16-bit register, then two 
write instructions are required. In 6502 



FUG 
REGISTER 



COUNTER 
REGISTER 



V 



rV 



CONTROL 
RHIISTER 



DATA BUS 



-TinSL. 




Figure 1. Block Diagram of a Typical Counter/Timer. 



October, 1979 



MICRO — The 6502 Journal 



17:27 



systems these registers are simply some 
of the 65536 memory locations. After N 
is loaded into the counter, it is 
decremented at a rate determined by the 
clocl< signal connected to the counter. 

When N decrements through zero, one 
of the bits in the flag register is set to 
logic one. Thus, the contents of the 
counter register change as follows: N, 

N-1, N-2 2, 1, 0, and on the next clocl< 

cycle the flag is set. Consequently it ac- 
tually takes N + 1 clock cycles to "time 
out." This summarizes the fundamentals 
of the counting/timing process. 

The control register is used to select 
one of several modes available to the 
programmer. For example, in one mode 
the contents of the counter register are 
decremented at the same rate as the 
system clock, while in another mode 
pulses on an external pin cause the 
counter to decrement, and in a third 
mode the counter is automatically 
reloaded after each time-out. The modes 
available with a 6522 will be discussed in 
more detail below. 

The 6522 Interval Timers 

The 6522 Versatile Interface Adapter 
Is a complex integrated circuit that in- 
cludes two eight-bit I/O ports, four pins 
associated with handshaking signals for 
these two I/O ports, and two interval 
timers. The I/O ports and handshaking 
pins will only be of incidental interest, 
and we will describe the use of a few of 
these features as the need arises. Our 
principal interest is in the two counter/ 
timers that are available on the 6522, 
called T1 and T2 respectively. Of course, 
the various registers needed to detect 
timing-out and to select the various tim- 
ing modes will also be of interest. 

In most 6502 microcomputer systems, 
the 6522 will be interfaced to occupy 16 
contiguous memory locations. The AIM 
65 and SYM-1, for example, use loca- 
tions with addresses $A000 to $AOOF for 
the 6522. Table I summarizes the names 
of each of these 16 locations, while 
Table II lists the functions of the 
registers. Of particular interest are the 
timer locations $A004 through $A009, 
the interrupt flag register (IFR), and the 
control register (ACR). These correspond 
precisely with the registers mentioned 
above in connection with Figure 1. That 
is, the IFR is the flag register and the 
ACR is the control register. 

Both counter/timers, T1 and T2, on the 
6522 are 16-bit devices; that is, a 16-bit 
number is loaded into the counter 
register and then decremented until 
time-out. Because the counter registers 
are 16-bit registers, two WRITE opera- 
tions are needed to load the counter 
since only eight bits of data can be writ- 
ten at one time. 

To prevent one eight-bit number (the 
low-order byte) from being decremented 



$4E— »A 



A— >T2U 



$C3— >A 



A— »T2CH 



IFE > A 



AA$20— >.! 



rEs 




IS A - 0'> 



Figure 2. Flowchart of i Simple 
Interval Timer Delay Loop. 



while the other (the high-order byte) is 
still not loaded, temporary storage lat- 
ches are provided. Using the T2 timer as 
an example, the low-order eight bits of 
the number, N, to be loaded into the 
counter are loaded into the low-order 
byte of the T2 latch (T2LL). Nothing hap- 
pens. Next, the high-order eight bits of N 
are loaded into the high-order byte of the 
T2 counter. Referring to Table II, this last 
operation has three important and 
simultaneous consequences: 

• The byte stored in the T2 latch 
(T2LL) is transferred to the low- 
order byte of the T2 counter 
(T2CL). T2 now contains a 16-bit 
number. 

• The Interrupt flag that signals the 
time-out, bit five of the IFR, is 
cleared (set to zero). It will be set 
(to one) when the number N 
decrements through zero. 

• The countdown begins. 

The T1 timer has two latches, one to 
store the low-order byte to be transfer- 
red to the counter, and one to store the 
high-order byte to be transferred to the 
counter. One reason for this difference 
is that the T1 timer has a "free-running" 
mode. At the end of one time-out, the 
two bytes of data stored in the latches 
are automatically transferred to the 
16-bit T1 counter to start a new timing in- 
terval. 

Furthermore, the values in the two lat- 
ches may be changed during one timing 
interval to give a new value for the next 
interval. The examples that follow 
should make these points clear. Addi- 
tional discussion of the READ opera- 
tions outlined in Table II will also be 
posponed until required by a specific 
example. 

A Simple Delay Loop Using the T2 Timer 

The most common application of 
counter/timers is the implementation of 
delay loops. The counter/timer replaces 
a series of instructions that are design- 
ed to waste time. The counter/timer 
simplifies greatly the instructions that 
are necessary to program a time delay, 
and furthermore, the computer may ex- 
ecute other tasks during the delay pro- 
duced by the timer, a feat that is much 
more difficult to perform with a software 
implemented delay loop. 

An assembly language version of a 
simple delay loop using the T2 timer on 
the 6522 is listed in Table III. The 
mnemonics are perfectly general for 
6502 systems, but the addresses of the 
registers of the 6522 are the ones given 
in Table II for the AIM 65 and the SYM-1. 
Programmers using other systems need 
only change the addresses to corres- 
pond to the locations of the 6522 
registers in the address space of their 



17:28 



MICRO — The 6502 Joiirnal 



October, 1979 



SAOQF 



Table I. Memory Assignment Names for the 6522 VIA. 



NAME 

Port B Input/Output Registers 

Port A Input /Output Registers (with handshaking) 

Port B Data Direction Register 

Port A Data Direction Register 
Timer 1 Latch Low-order Byte (HEITE) 
Timer 1 Counter Low-order Byte (READ) 
Timer 1 Latch High-order Byte (WRITE) 
Timer 1 Counter High-order Byte (READ) 

Timer 1 Latch Low-order Byte (READ or WRITE) 

Timer 1 Latch High-order Byte (READ or WRITE) 

Timer 2 Latch Low-order Byte (WRITE) 

Timer 2 Counter Low-order Byte (READ) 

Timer 2 Counter High-order Byte (READ or WRITE) 

Shift Register 

Auxiliary Control Register (Control Register for T:: ners) 

Peripheral Control Register 

Interrupt Flag Register (Status Register) 
Interrupt Enable Register 

Port A I/O Register (without handshaking) 



ADDRESS 


SIMBO: 


SAGOO 


0?£ 


UOOl 


OFA 


$A002 


DDRB 


$A003 


DDRA 


SAOOt 


TILL 


$A004 


TICL 


SAOOj 


TILH 


$A005 


TICK 


$A006 


TILL 


U007 


TILH 


$A008 


T2LL 


$A008 


T2CL 


U009 


T2CH 


UOQA 


SE 


SAOOB 


ACR 


SAOOC 


PCR 


SAOCD 


IFR 


SAOQE 


lER 



ORA 



systems. Pay careful attention to the 
comments in Table III, because they 
relate each step to points in our previous 
discussion. Figure 2 is a flowchart of the 
delay loop, and it has a box for each of 
the instructions in Table III. 

In the program listing given in Table 
III, timing begins at the completion of 
the STA T2CH instruction. The program 
waits in the loop consisting of the series 
of instructions LDA If-R, AND $20, BEQ 
WAIT until the time-out of the T2 timer 
sets bit five of the interrupt flag register. 
The formula for the time T required for 
the interval timer to time-out is: 

T = (N -t- 1)Tc 

where N is the 16-bit number loaded into 
the counter and T^ is the clock period 
(typically one microsecond). 

If the branch instructions (LDA IFR, 
AND $20, BEQ WAIT) are taken into ac- 
count, then the total loop time, T[_, is 
given by the expression: 

(N -t- 6)T(;<Tl<;(N -t- 14)Tj. 

The uncertainty of eight cycles in the 
loop time arises from the uncertainty of 
where the T2 counter/timer actually 
times out in the series of test and branch 
instructions within the loop. For the 
numbers that were used in Table III, 



ADDRESS SYMBOL 

SAOOt TILL 

$AOav TICL 

$AC105 TILH 



$A005 TICK 

$A006 TILL 

$A006 TILL 

UOCf? TILH 

$A007 TILH 

$A008 T2LL 

$A008 T2CL 

$A009 T2GH 



$A009 T2CH 
$AOOB ACR 
$AOa) IFR 



Table II. Memory Assignments and Fuictions of Some of the 
Registers of the 6522 VIA. 

FUNCTION 
WRITE (STA TILL): Load an eight-bit number ij to the low^order byte of the Tl latch. 
READ (LDA TICL): Read the contents of the loi -order byte of the Tl counter, and 

clear the interrupt flag, b: t six of the IfH. 
WRITE (STA TILH): Load an eight-bit number ii to the high-order byte of the Tl latch, 

transfer the contents of b( th Tl latches to the Tl counters, clear 

the Tl interrupt flag, and start the counting process. 

Read the contents of the h:.gh-order byte of the Tl counter. 

Load an eight-bit number into the low-order byte of the Tl latch. 

Read the contents of the low-order byte of the Tl latch. 
WRITE (STA TILH): Load an eight-bit number into the high-order byte of the Tl latch 

and clear the Tl interrupt flag. 

Read the contents of the high-order byte of the Tl latch. 

Load an eight-bit number into the low-order byte of the T2 latch. 

Read the contents of the low-order byte of the T2 counter, and clear 

the interrupt flag, bit five of the IfH. 

Load and eight-bit number into the high-order byte of the; T2 counter, 

transfer the contents of the low-order byte in the T2 latch to the 

low^order byte of the T2 counter, clear the T2 interrupt flag, and 

start the counting process. 



READ (LDA TICK): 
WRITE (STA TILL); 
READ (LDA TILL): 



READ (IDA TILH): 
WRITE (STA T2LL): 
READ (LDA T2CL): 

WRITE (STA T2CH): 



READ (LDA T2CH): 



Read the contents of the high-order byte of the T2 counter. 

Bits five, six, and seven control the modes of Tl and T2. 

Bit six equal to one signals a time-out of the Tl counter/timer. Bit 

five equal to one signals a time-out of the T2 counter/tdjner. 



October, 1979 



MICRO ~ The 6502 Journal 



17:29 



Figure 3. 60 Hz Signal Conditioner for the Low Overhead C ock. A 
circuit based on the 555 timer and using only the + 5V suptJly can 
be found in Berlin's 555 Timer Applications Sourcebook, pgs.Z- 13. 



+12V to +15V' 




12V to -15V 



T = ($C34E + 1)1. = 0.05 seconds for 
a one microsecona clock. The loop time 
Is between 5 and 13 microseconds 
longer. For many applications, this 
uncertainty will be of no consequence. 

As pointed out earlier, the 
microprocessor need not be idle while 
the timer is timing out. For the particular 
delay of 0.05 seconds programmed in 
Table III, a total of 50,000 clock cycles 
elapse while the timer is running. During 
that time, between 25,000 and 10,000 in- 
structions could be executed by the 
6502. These instructions would be 
placed between the STA T2CH and the 



LDA IFR instructions. This Is the prin- 
cipal advantage of the counter/timer im- 
plemented delay loop; that is, the micro- 
processor can be performing meaningful 
tasks during the timing-out process. 

Counting Pulses — A 24-Hour Clock 

The T2 timer can also be usee to count 
pulses from an external sourcij. This is 
useful for frequency counting {MICRO, 
June 1979, pg. 41) or any otiier event 
counting application such as radio- 
active half-life measurements The T2 
timer is placed in its pulse counting 
mode by setting bit five in the auxiliary 



Table III. A Simple Delay Loop Using the T2 Timer on the 5522. 



$0300 A9 4E 3TAET LDA $4E Load the byte for the T2 latch low, then 

$0302 8D 08 AO STA T2LL transfer it into T2 latch low (T2:i). 

$0305 A9 C3 LDA $C3 Load the byte for the T2 counter ligh, 

$0307 8D 09 AO STA T2CH then transfer it into T2 counter ligh (T2CH) 

$03QA AD OD AO WAIT LDA IHl Read the flag register, im. Maslc all bits 

$030D 29 20 AHD $20 except bit five. Check to see if bit five 

$030F TO F9 BEQ WAIT is set. No, then wait. Yes, loop is finish 



control register (ACR) to logic one, and 
applying the TIL level pulses to bit six of 
port B, PB6. To illustrate this mode, and 
to illustrate how the timers can be used 
to generate interrupt requests (IRQs), we 
have chosen to describe a simple 
24-hour clock that requires very little 
computer time overhead. 

The 60 Hz power line frequency is suf- 
ficiently stable over long periods for 
many clocks. Somewhere in your micro- 
computer system you will probably be 
able to locate a low-voltage 60 Hz 
source. This is conditioned by the circuit 
shown in Figure 3 to produce a 60 Hz 
square wave, and the output Is applied 
to PB6 to be counted. Clearly there are 
3600 ($0E10) such pulses in a minute. 

The T2 counter/timer will be program- 
med to count 3600 pulses followed by an 
interrupt request. The interrupt routine 
increments one location in memory to 
keep track of minutes, and when this 
location reaches 60, another location is 
incremented to keep track of the hours. 
At the beginning of the interrupt routine 
the T2 counter/timer is reloaded with 
3600 for the next period. 

The program is listed in Table IV. The 
first two instructions set bit five of the 
ACR to logic one. Next the timer is load- 
ed with $OEOF. Note that $OEOF + 1 = 
3600. The LDA SAO and STA lER instruc- 
tions enable interrupts from bit five of 
the interrupt flag register (IFR) of the 
6522 to the 6502 microprocessor's IRQ 
pin, a connection that is usually internal 
to the microcomputer system. 

To enable interrupt request signals 
from T2, bit five of the lER (interrupt 
enable register) must be set to logic one, 
with bit seven of the lER also set to logic 
one. At the end of the timing interval, not 
only will bit five of the IFR be set to one, 
but also the IRQ pin on the 6502 micro- 
processor will be pulled to logic zero, 
producing an interrupt request. 

The next instruction after enabling the 
interrupt from the T2 timer is the CLI in- 
struction that allows the 6502 to 
recognize these interrupts. The last in- 
struction in the main program should 
not be taken literally. It is simply an 
infnite loop that represents the user's 
main program, a FORTRAN interpreter 
for example. 

The interrupt routine is also given in 
Table IV. Timekeeping routines have 
been described in several other articles 
(MICRO, March 1979, pg. 5), so the 
details will not be repeated here. Note 
that in order for the program to execute, 
the IRQ vector must point to the starting 
address of the interrupt request routine, 
in our case $0300. Note also, that the 
program could be easily modified to 
keep track of seconds by counting only 
60 pulses, something that can be done 
with an eight-bit counter like the one on 
the R650/1. The hours-minutes clock re- 
quires only about 50 microseconds per 



17:30 



MICRO — The 6502 Journal 



October, 1979 



minute of computing time, truly a low- 
overliead clock. 

To display the minutes and hours, the 
user must provide a display routine that 
takes the contents of locations $0000 
and $0001 and displays these numbers. 
Such a routine is not included in Table IV 
since the instructions used will depend 
on the microcomputer system, and 
previously written clock programs have 
included suitable display routines. 

To summarize the operation of the T2 
counter/timer on the 6522 we conclude 
this section with the following state- 
ments: 

• To decrement the 16-bit number in 
the T2 counter at the system clock 



rate, clear bit five of tf e ACR. 

To decrement the 16-bi : number in 
the T2 counter using external 
pulses applied to PBii (pin 6 of 
Port B), set bit five of Ihe ACR. 

To produce an intern pt request 
(IRQ) when the cour ter decre- 
ments through zero in isither of its 
modes, set bits five ar d seven of 
the lER. 

To disable the interrupt feature, 
set bit five of the lER a id clear bit 
seven of the lER. 

A system RESET disables the 
pulse-counting mode and the in- 
terrupt request feature ay clearing 
all the registers of the 3522. 



J 



$0200 A9 20 
$0202 8D OB AO 
$0205 A9 OF 
$0207 8D 08 AO 
$02CA A9 OE 
$020C 8D 09 AO 
$020F A9 AO 
$0211 ffi OE AO 
$0214 58 
$0215 4C 15 02 



$0300 A9 OB 
$0302 a) 09 AO 
$0305 18 
$0306 F8 
$0307 A 5 00 
$0309 69 01 
$030B 85 00 
$03QD C9 60 
$030F DO 13 
$0311 A9 00 
$0313 85 00 
$0315 18 
$0316 A 5 01 
$0318 69 01 
$03U 85 01 
$031C C9 24 
$031E DO 04 
$0320 A 9 00 
$0322 85 01 
$0324 D8 
$0325 40 



October, 1979 



Table IV. Low Overhead 24-hour Clock. 

MAIN 



HERE 



DONE 



IDA $20 
STA ACR 
IDA $0F 
STA T2LL 
LDA $CiE 
STA T2CH 
LDA $A0 
STA lER 
CU 
JMP HERE 



Put T2 in its pulse-corn ting mode 
by setting bit five to logic one. 
Set up T2 to count 36OO pulses. 



Set up interrupt enable register 
to permit IRQ from T2. 
Allow 6502 to accept IRQ signals. 
Loop here between interrupts. 



INTERRUPT ROUTINE 



LDA $0E 
STA T2CH 

ck; 

SED 

LDA MIN 
ADC $01 
STA MIN 
CMP $60 
HNE DONE 
UA $00 
STA MIN 

ck; 

LDA HRS 
ADC $01 
STA HRS 
CMP $24 
BNE DONE 
LDA $00 
STA HRS 
CLD 
RTI 



Start counting pulses again by 

loading T2CH. 

Clear 'carry for addition. 

Set decimal mode for addition. 

Get minutes. 

Add one. 

Is one hour complete? 

No, get out of interrupt routine. 

Yes, set minutes to zero. 



Get hours. 
Add one. 

Is one day complete? 

Clear hours. 

Clear decimal mode. 
Return to the main progrsim. 



MICRO — The 6502 Journal 



Producing Long Time Delays 

The maximum time delay that can be 
produced with the T2 counter/timer 
when it is decrementing at the system 
clock rate is approximately ($FFFF -t- 
1)Tc or 0.065536 seconds if Tq = 1 
microsecond. In certain applications 
longer time delays are necessary. To ob- 
tain these delays, the T1 timer is used in 
conjunction with the T2 counter/timer. 
We digress for a moment to Introduce 
the T1 timer. 

The T1 timer can be used to imple- 
ment a simple delay loop in exactly the 
same way as the T2 timer. Refer to Table 
III. If the addresses $A004 and $A005 
replace addresses $A008 and $A009, 
respectively, and if bit six of the inter- 
rupt flag register (IFR) is tested rather 
than bit five, then the program in Table 
III will work in exactly the same way ex- 
cept that the T1 timer is being used. 

The same equation gives the loop time 
and, as in the case of the T2 timer, the 
maximum delay is about 0.065 seconds. 
The T1 timer cannot, however, count 
pulses. Consequently it cannot replace 
the T2 timer in the program listed in 
Table IV. In place of the pulse counting 
mode, the T1 timer has a free-running 
mode, and it is capable of toggling the 
logic level on pin seven of Port B, PB7. 

The initialization of the free-running 
mode with PB7 toggling is illustrated in 
a simple program shown in Table V. This 
program will produce a square wave out- 
put on PB7. The period of the square 
wave is given by the equation: 

Tp = 2(N + 2)Tc 

where In is the period of the square 
wave, N is the 16-bit number loaded Into 
the T1 timer, and T^, is the period of the 
system clock (Typically one micro- 
second). The frequency of the square 
wave is f = 1/Tp. 

To initialize this mode, bits seven and 
six of the auxiliary control register (ACR) 
m.ust be set. Thus, the program in Table 
V begins by loading $C0 into the ACR. 
Timing is initiated by loading the high- 
order byte of N into location $A005 
which corresponds to T1LH. Once 
started, the square wave will run forever, 
no matter what else is happening in the 
program, provided the registers that 
control the behavior of the T1 timer are 
not changed. That is, after the timer 
"times out", it will automatically reload 
the two counter registers from the 
numbers stored in Its latches, TILL and 
T1LH. 

The last instruction in Table V is an in- 
finite loop that sim-ulates the user's pro- 
gram intended to run concurrently with 
generation of the square wave. Table VI 
lists some values for N that are frequent- 
ly used in timing applications. If you 
have an oscilloscope, run the program 
with various values of N and connect the 
(Continued on page 34) 

17:31 



ATARI® PERSONAL COMPUTER 

CCI COMPUTER SYSTEMS DELIVERS . . . NOW!!! 




ATARI® 400™ 

PERSONAL COMPUTER 
SYSTEM 

PRICE INCLUDES: 

Computer Console 
BASIC Language Cartridge 
BASIC Language Programming 

Manual (Wiley) 
400 Operator's Manual with 

Note Boole 
Power Supply 
TV switch Box 




$549 



99 



ATARI® 800™ 

PERSONAL COMPUTER SYSTEM 
PRICE INCLUDES: 

Computer Console 
BASIC Language Cartridge 
Education System Master Cartridge 
BASIC Language Programming 

Manual (Wiley) 
800 Operator's Manual with Note Book 
ATARI 410 Program Recorder 
Guide to BASIC Programming Cassette 
8K RAM Moduie'Power supply 

TV switch Box 

$99999 



WE PROMISE TO DELIVER!!! 

• We GUARANTEE Ship dates on prepaid computer Systen orders. Send your orders in now!!! 

• If for reasons beyond our control we miss a ship date, ve will refund the shipping and 
handling charges and give you a 10% DISCOUNT on any Future software purchases for your 
ATARI® System.* 

• For prepaid system orders, get a free Accessory contrc ller of your choice. 

'Order must be prepaid by Cashier's Check made out to computer Comp inents of Orange County. 



ATARI USER'S GROUP INFORMATION . fl . CALL (714) 891-2584 



PERIPHERALS AND ACC ESSORIES 



$749.99 



ATARI® 810™ 
DISC DRIVE* 

DISKETTES 

CX8IOO BLANK DISKETTES* 
CX8101 DISK FILE MANAGER- 

$5.oo/ea. 



ROM CARTRIDGES 

CXL4001 EDUCATION SYSTEM MASTER 
CARTRIDGE $34.99 

KEY: (J) = uses lovstlcK Controller 
(p) = uses oaddle controller 
(d) = uses driving controller 



ATARI® 820^ 
PRINTER* 



$5 19.99 



ACCESSORY CONTROLLERS 

CX2C-01 DRIVING CONTROLLER PAIR 
CX30-04 PADDLE CONTROLLER PAIR 
CX40-04 JOYSTICK CONTROLLER PAIR 
S19.95/ea. 



SOFTWARE 

GAMES $49.9! /ea. 

CXL4004 BASKETBALL I|l 

CXL400S LIFE (Jl 

CXL4006 SUPER BREAKOUTTM (di 

CX4008 SUPER BUG™' • (d) 



ATARI® 410™ 

PROGRAM RECORDER $89.99 

ADD-ON MEMORY (800 ONLY) 



CX852 8K RAM MEMORY MODULE 
CX853 16K RAM MEMORY MODULE 



SI 24.99 
S249.99 



APPLICATION $69.99 

CXL4002 ATARI BASIC 

CXL4003 ASSEMBLER DEBUG' ' 

CXL4007 MUSIC COMPOSER 

CXL4009 COMPUTER CHESS" (II 



EDUCATION SYSTEM CASSETTE PROGRAMS 

CX6001 U.S. HISTORY 
CX6002 U.S. GOVERNMENT 
CX6003 SUPERVISORY SKILLS 
CX6004 WORLD HISTORY (WESTERN! 
CX6005 BASIC SOCIOLOGY 
CX6006 COUNSELING PROCEDURES 
CX6007 PRINCIPLES OF ACCOUNTING 
CX6008 PHYSICS 



$39.99 /ea. 



CX6009 GREAT CLASSICS (ENGLISH) 
CX6010 BUSINESS COMMUNICATIONS 
CX6011 BASIC PSYCHOLOGY 
CX6012 EFFECTIVE WRITING 
CX6013 AUTO MECHANICS 
CX601 4 PRINCIPLES OF ECONOMICS 
CX601S SPELLING 
CX6016 BASIC ELECTRICITY 
CX6017 BASIC ALGEBRA 



BASIC GAME AND 
PROGRAM CASSETTES 

CX4101 GUIDE TO BASIC PROGRAMMING' 
CX4102 BASIC GAME PROGRAMS' 

529.95/ ea. 

'October Delivery ' 'November Delivery 

—Prices subject to change.— 



COMPUTER COMPONENTS OH ORANGE COUNTY 



6791 Westminster Ave., Westminster, CA 9268 ; 7ia-89l-2584 Telex 182274 

Hours: Tues-Fri 11:00 AM to 8:00 PM— Sat 10:00 AM tO 6:00 'M— Sun 12:00 tO 4:00 PM (Closed IV 

Master Charge, visa, B of A are accepted. Allow 2 we eks for personal check to clear. 

Add $2.00 for handling and postage. For computer syst ms please add $10.00 for shipping 

handling and insurance. California reside ts add 6% Sales Tax. 

• MAIL ORDER LINE (714) 891-2587 or' TELEX 182274. 



VAN NUYS 
(213)786-7411 



BURBANK 
(213)848-5521 



LAWNDALE 
(213)370-4842 



ORANGE COUNTY 
(714)891-2584 



IRVINE 
(714)891-2589 



In Southern California we're iMumber One!! 

COMPUTER COMPONENTS (CCI) OF ORANGE COUNTY, your full 

support computer store presents the finest In personal computers 

Send for our 36 page fully illustrated catalog =3"°. Save 50C by sending the top one inch of this ad with your order. 




AN INDUSTRY STANDARD 



^appkz cx>mputGr 



Apple II or 
Apple II Plus 
with 16K 
51195 



J' 




SPECIAL 

13 "Color TV 

compatible 

with Apple II 

only 9900 

with system 

purchase 




APPLE tl Will Change the way you think about computers. 
That's because it Is specifically designed to handle the 
day to day tasks of education, financial planning, 
building security, scientific calculation, and 
entertainment APPLE II Is appealing and comfortable 
(like other appliances that make your life easier); and It 
brings to personal computing a new level of simplicity 
through hardware and software sophistication. 



INTERFACE :AROS 

ProtoCYPlnti/Hot)t)vCarc] $ 24.00 

Parallel Prlrnennterf ace Card 180 00 

communications Card & OB25 
Connector ':aoie 22S.00 

High-speed serial interfaceCard 19S.00 

Language SvStem with Pascal 

IdSK RAM « Disk II Required) 49S.00 

Applesoft II rtrmware Card 2D0.00 

16 input An.itog Card 29500 

ACCESSORIES 

Dtstcii— orlvE'Oniv a95.oo 

Dtstc II— Orlvi! & Controller (32K Min. 

RAM Recormendedi 595.00 

vinyl carrvtng Case 30.00 

Tape Recorder ao.oo 

Programmert Aid NO- 1 Firmware (For 

use with Integer BASIC) bo.oo 

Clock / Calerdar Card 1 99.00 

Auto— Stan ROM Package (For 

Apple It Oniyl 6S.00 

oigtkltlzer fad by Taios 

iKtttormI 499.00 

High Resolution Light pen 199.00 

Mlcromodeni (DC. HayesJ 379 00 

12" S/w Le€i3ex Monitor 149.00 

Cable from Monitor to Apple 11 9-9S 

13" Color P' Compatible with 

Apple 11 290-00 

Sup-R-Moduiator(Rf) 25.00 

SOFTWARE [OR APPLE II 

PASCAL fror- Programma 49.95 

FORTH ^aas 

LISP— from. ippie Software 8K NO- 3 N/c 

LISA— interactive disk assembler 34.9S 

WHATSIT- Excellent conversational data 

basemanager 32K10O.O0 aat(i25.oo 

SARCON-Champ of 2nO west coast 

computer pake i9.9S 

APPLE PIE- Excellent text editor 2a.95 

FORTE— Music editor In hires 19.9S 

FASTCAMMCtN- Excellent Dackgammon 

game witn graphics Tape 20.00 Disk 25.00 
APPLE 21— t xceiient blackjack game 9.95 

BRIDGE CHALLENGER— computer bridge 14.95 

FINANCIAL MANAGEMENT SYSTEM 

• Accounts payable • Le(ager Processing 

• Accounts Receivable • Payroll 

• Inventory Control • S800 Complete 

• $200 Eacr Package • 510 for Manual 



PRINTER SPECIALS FOR APPLE AND PET 
TRENDCOM 100 w(i:h Interface for 

Apple or PET 450 00 

LITE PEN used with TV or monitor 

screen 34 gs 

ALF Music synthesizer Boards 265.00 

Supertalker 279 oo 

Anadex DP-aoOO with tracter 

8' paper width and interface 

to Apple 1050.00 

Centronics 779-2 for Aople il 

with parallel interface 1 2^5 oo 

SOFTWARE (Send For complete software 

Catalog $1.00) 

Dow Jones Portfolio evaiuator/ 

Stock Quote Reporter Disk 50.00 

Microchess 2.0 Chess Disk 25.00 

Disk utility pack w«th DOS 3 2 25.00 
The controller (General Business 

System) 625.00 

Apple post (Mallinc) List System) 19.95 

Bowling Program Diskette 15.00 
The Cashier (Retail store Management 2 SO 00 

Checkbook cassette 20 00 
Applesoft II Language & Demo 

Cassette 20.00 

RAM Test Tape with Manual 7 . 50 

Finance 1-2 cassette Package 25 00 
Datamover/Teiepong cassette 

(Com cards Modem HeqO) 750 

Microchess 2.0 Chess Tape 20 00 

Bowling Program Tape 15 00 
Pascal with Language System 

<48K RAM S Disk II Required) 495.00 

MISCELLANEOUS 

Vinyl Diskette Holder Pages 
(PkgofiO) a. 50 

Diskette Boxes (BA Piastici 4 50 

Diskettes (5) 
Apple (Box of 10) 50 00 

verbatim (Sox of 10) Ji 00 

Dysan(8oxof 5) 25 00 

Decals (Rainbow Apple) 
Inside window (2 1 loc 

OutsWe window 1 2' I 1 0C 

Outside windowir I 5C 

Apple Logo (Rainbow) T-Shlrts 6 00 

Specify— Men. women, or chllO (small, 
medium, or large) 



Reference Books for Apple and PET Owners 

Programming Manual (MOSTEK) S12.00 

Hardware Manual (MOSTEK) 12.00 

Programming the 6502 (ZAKSi 9.95 

6502 Application BOOkCZAKS) /2.95 

Programming a Micro computer: 6502 (FUSTER) 9.95 

PET Owners Only 

PETUserManual S9.95 

Hands on BASIC with a PET 14.95 

PET Machine Language Guide 9.95 



Apple Owners only 

Apple II Reference Manual SiO.OO 

Applesoft Manual lo.oo 

Programmer's Guide (Computer station) 5.95 

Apple II Monitor Peeled 9.95 

Software Directory for Apple 

• Business, Finance & utiiltv 495 

• Games, Demo, Utiiltv 4-95 

Best of contact 78 2.50 

programming in PASCAL (Grogono) 9.90 



A PROFESSIONAL BUSINESS SYSTEM 



80 COL. DOT 
MATRIX 
PRINTER 




2001-1 SB 
S995 
Also 

2001-8 S795 

2001 -16N S995 

2001-32N . . .51295 
2001-32B . .51295 



CBM 2040 
S1295 
Also 

External 

cassette S95 

PET to IEEE 

cable S39.95 



CMB 2022 
$995 
Also 
C8M 2023 

printer S849 

IEEE to IEEE 

cable $49.95 



•Retrofit kit required for operation with PET 2001-8. 



ACCESSORIES FOR PET 

Commodore PET Service Kit $30.00 

Beeper -Tells when tape Is Loaded 24.95 

petunia— Play music with pet 29.95 

Video Buffer— Attach another display 29.95 

Combo— Petunia and Video Buffer 49.95 

SOFTWARE FOR PET 



Mirrors and Lenses 19.95 

Thestaies 14.95 

ReaiEstatei &2 59.95 

Momentum and Energy . .19.95 

Projectile Motion 19.95 

Mortgage 14.95 

DOW Jones 7.95 

Petunia Player Sftwr . . . .14.95 
iMus many more, send for 



Checkers and Baccarat .... 7.95 

Chess 19.95 

series and Parallel 

Circuit Analysis 19.95 

Home Accounting 9.95 

BASIC Math 29.95 

Game Playing with BASIC 

vol. 1, 11, III 9.95 each 

software Catalog $1.00. 



—Prices subject to change— 



J 



COMPUTER COMPONENTS OP ORANGE COUNTY 

6791 Westminster Ave., Westminster, CA 92683 714-891-2584 Telex 182274 

Hours: Tues-Fri '11:00 AM to 8:00 PM— Sat 10:00 AM tO 6:00 PM— Sun 12:00 tO 4:00 PM (Cl0Se(3 MOn) 

Master Charge, visa, B of a are accepted. Allow 2 weeks for personal check to clear. 

Add $2.00 for handling and postage. For computer systems please add $10.00 for shipping, 

handling and insurance. California residents add 6% Sales Tax. 



input of the oscilloscope to PB7 to 
monitor the square wave. You can use 
the program to calibrate your 
oscilloscope sweep time. If you have a 
frequency counter, measure the frequen- 
cy of the square wave at PB7 to verify 
the equation, using the values for N 
given in Table VI. N is the number to be 
loaded into T1. 

Note that the frequency of the square 
wave produced at PB7 by the program 
listed in Table V is as precise as the 
crystal oscillator frequency used for the 
system clock. This is because the 
square wave frequency is independent 
of any instruction length. The principal 
advantage of the free-running mode of 
the T1 timer is that the time between in- 
terrupt flag settings (or the frequency of 
the square wave on PB7) is independent 
of any Instruction length. Thus, one can 
construct very precise time-keeping 
routines {MICRO, March 1979, pg. 5) or 
time measuring routines. 

To produce simple delay loops for 
long time intervals, the pulses from PB7 
are fed to PB6. Timer T1 operates in its 
free-running mode, and timer T2 
operates in its pulse counting mode. 
Consequently, T2 counts the pulses pro- 
duced by T1 on PB7. A program to pro- 
duce a delay of one hour is given in 
Table VII. This program may be easily 
modified to produce delays of 1, 10, 60, 
100, 1000, 10000, 36000, or 65536 
seconds. 

Timer T1 produces a square wave 
whose period is 0.1 second. These 
pulses are counted by the T2 counter/ 
timer. If nine is loaded into T2, then 10 
pulses, each of 0.1 second duration, will 
be counted, giving a delay of one se- 
cond. Other time intervals are program- 
med accordingly. Of course, there is an 
uncertainty of several microseconds in 
the actual loop time, but this uncertainty 
will be unimportant for most applica- 
tions. 

If the program in Table VII is modified 
to allow T2 to produce interrupt requests 
(IROs) by loading SAO into the interrupt 
enable register (lER) at location $AOOE 
(refer to Table IV), then it could be used 
in connection with the interrupt routine 
given in Table IV to produce a 24-hour 
clock program. To generate an interrupt 
every minute, as required by the low- 
overhead clock, T1 should count to 600. 
Load T1 with $0257 instead of $C39F as 
shown in Table VII and your clock should 
run. These modifications are shown in 
the AIM 65 disassembly format. 

Sound Effects 

The T1 timer can be used in its free- 
running mode to toggle PB7, and PB7 
can be used to drive an amplifier. If the 
frequency is in the audible range, then a 
tone will be heard. A series of tones may 
make up a song. Table VIII lists the fre- 
quencies necessary to produce three oc- 



17:34 



t<— T 



Ji 



TIMING 
PULSE 
INPUT E^*~ 



■S> 



[PB>> 



_rLrLrL_ 



741200 




■{m> 



Figure 6. Circuit to measure the time duration, T, of a positive pulse. 
The CB1 pin must be programmed to produce an interrupt on the 
negative transition of the pulse by loading PCR4 with a zero. 
Change the byte at $0217 from $10 to $00 in the listing in Table X to 
accomplish this. 



Set bits seve.n and six of the ACR, 

putting the Tl timer in its free-running 

mode v(ith a square wave output on PB7. 

Let N = $oaj). T = 2($50) microseconds 

« l60 microseconds. 

Start timer. 

Dummy loop simulates reirainder of a program. 



Table V. Program to Produce a Square Wave Output on PB7. 



$0200 A9 CO 


START 


LDA 


$C0 


$0202 8D OB AO 




STA 


j.CR 


$0205 A9 4D 




LDA 


:;4D 


$0207 3D 06 AO 




STA 


"ILL 


$0204 A9 00 




LDA 


:.oo 


$020C 8D 05 AO 




STA 


"ILH 


$Q20F 4C OF 02 


LOOP 


JMP 


J0DP 



FlffiQUENCY 


PIRIOD 


N -f 2 




N 


f 


T 
P 


Decimal 


Hex 


Hex 


10 Hz 


0.10 sec 


50000 = 


$C350 


$S3AD 


100 Hz 


Ci.Ol sec 


5000 = 


$1388 


$1386 


1000 Hz 


1 . 00 ms 


500 = 


$01F4 


$01F2 


10 kHz 


C^IO ms 


50 = 


$0032 


$0030 


100 kHz 


C'.Ol ms 


5 = 


$0005 


$0003 


250 kHz 


/j.OO us 


2 = 


$0002 


$0000 



Table VI. Table for Producing Various Square Wave Frequencies. 



Load ACR to put Tl in free-running mode 

and T2 in pulse counting mode. 

Initialize Tl timer to run with a period 

of 2($C3AD + 2) = 100000 microseconds 

= 0.1 second. 

Start timer toggling PB?. 

Set up T2 to count $8C9r + 1 = 36000 

counts. (36000) (O.lsec) = 1 hour. 

Start counting. Clear IFR. 

Check interrupt flag register to see if 

bit five has been set, indicating that 

T2 has counted 36OOO pulses. 

Break to the monitor at the end of an hou 

Produce a One-Hour Delay. 

October, 1979 



$0200 A9 EO 


START 


UIA $E0 


$0202 8D CB AO 




S"A ACR 


$0205 A9 u3 




UIA $ZJ3 


$0207 8D 06 AO 




S"A TILL 


$a20A A9 C3 




LIiA $C3 


$020C SD 05 AO 




S^'A TILH 


$02GF A9 9F 




UIA $9F 


$0211 8D 08 AO 




SVA T2LL 


$0214 A9 80 




LIA $8C 


$0216 8D 09 AO 




SrA T2CH 


$0219 A9 20 




UA $20 


$Q21B 20 OD AO 


TEST 


BIT IFR 


$021E FO FB 




HEIQ TEST 


$0220 00 




HK 


Table VII. 


Program to 


MICRO - 


The 6502 Jour ial 



taves of notes on the equally tempered 
scale (note middle A corresponds to 440 
Hz and successive note frequencies are 
related by a factor equal to the 12th root 
of two). Also listed in Table VIM are the 
half periods in microseconds; that is, the 
numbers that must be loaded into the T1 
timer to produce the notes. Since the 
period of the square wave is (N + 2)1^, 
each of the numbers in the last column 
of Table VIM should be decremented by 
two. 



A program to play songs using the 
notes in Table VIII is listed in Table IX. 
The identification numbers (I.D. num- 
bers) of the notes in the song to be 
played are stored in a song tcible star- 
ting at $0400. Actually, the song could 
be stored anywhere in memory that is 
convenient, simply by changing the base 
address of the song table. The base ad- 
dress of the song table is stored in $0050 
and $0051, called SONG and SONG -i- 1, 
respectively. 



J 



Table Vlll. Note Table for 


Scale. 




I.D. NTJMBER 


NOTE 


Hex 




$00 


^0 


$01 


Co# 


$02, 


°o 


$03 


°o# 


$0,, 


E 




$05 
$06 


F 




$07 


Go 


$08 


%* 


$09 
$0k 


A 



^0* 


$0B 


^0 


$0C (middle 


)c, 


$0D 


C^# 


$02 


D 


$0F 


D^# 


$10 


■^1 


$11 


F 


$12 
$13 


^1 


$14 


G^# 


$15 


A 


$16 


A^# 


$17 


B^ 


$18 


^2 


$19 


C/ 


$U 


°2 


$1B 


D/ 


$1C 


^2 


$1D 


^2 


$1E 


F/ 


$1F 


^2 


$20 


G/ 


$21 


^2 


$22 


A/ 


$23 


^2 


October, 1979 





Producing Tones on the Equally Tempered 



FEIEQJENCY 
Hertz 
130.813 
138. 591 
146.832 
155.563 
164. 814 
174.614 
134.997 
195.998 
207.652 
220.000 
233.082 
246.945 
261.626 
277.183 
293.665 
311.127 
329.628 
349.228 
369.995 
391.995 
415.304 
440. 000 

466.164 

493.883 
523.251 
554.365 
587.330 
622.254 
659.255 
698.456 
739.989 
783.991 
830.609 
880.000 
932.328 
987.767 



PERIOD/2 

Microseconds 

$OEEE 

$QE18 

$0D4D 

$ocaE 

$QBDA 
$aB2F 
$0A.8F 
$09F7 
$0968 
$08E1 
$0861 
$C7E9 
$0777 
$070C 
$06A7 
$0647 
$05E1D 
$0598 
$0548 
$Q4FC 
$Q4B4 
$0470 
$0431 
$03F4 
$03B: 
$0386 
$0353 
$0323 
$02F6 
$02CC 
$02A4 
$027E 
$02 5A 
$0238 
$0218 
$01FA 



MICRO — The 6502 Joiirnai 



The identification numbers ($00 -$23) 
found in the song table are used to index 
a note table found in page zero, from 
$0000 to $0047. The note table contains 
the half-periods of the frequencies 
found in the fourth column of Table Vlll, 
corrected for the fact that the half- 
period is (N -I- 2)Tg rather than (N)Tp. 
The low-order bytes of the haif-perioos 
are found from $0000 to $0023 in the 
note table, while the high-order bytes are 
found from $0024 to $0047. 

The program first locates an iden- 
tification number for a note from the 
song table. It then loads the latches on 
the T1 timer with the correct half period, 
and the note begins to play. The dura- 
tion of the note is determined by a 
number found in the duration table, call- 
ed DUR, and located from $0800 upward. 
There must be one duration number for 
each note. The duration of a note is 
basically the number of times the T2 
timer is allowed to time out. If $01 
represents a sixteenth note, then $02 is 
an eighth note, $04 is a quarter note, $08 
a half note, and $10 a whole note. The 
tempo may be changed by changing the 
bytes loaded into the T2 timer at loca- 
tions $021 E through $0227 in the pro- 
gram listed in Table IX. 

The song table given in Table IX simp- 
ly plays the three octave scale from 
Table Vlll with a variety of durations as 
indicated by the duration table. You are 
invited to make your own song or 
translate someone else's song into I.D. 
numbers. Better yet, write a song inter- 
preter that does the translation for you. 

Your interpreter should take a 
keyboard entry for a note and place the 
I.D. number into the song table. It should 
take another keyboard entry for the time 
value of the note and place it in the dura- 
tion table. With several 6522s, you could 
play four-part harmony! With a D/A con- 
verter and a voltage controlled amplifier 
you could also control the note 
envelopes, giving an elementary syn- 
thesizer. 

For my interface circuit, I used the 
7404 inverter connected to PB7. The out- 
put from the 7404 was connected to one 
lead of a 1 V2 inch speaker and the other 
lead was connected to -i-5 volts. Better 
interfacing circuits to drive speakers 
have appeared in various articles and 
books (see Caxton Foster's Programm- 
ing a Microcomputer). 

Measuring the Time Between Events 

A number of applications require that 
the time between two successive events 
be measured. The events might be the 
start and finish of a race, the arrival of 
cosmic rays, two heartbeats of an 
animal, and many others. If the events 
are periodic, then the time between 
events can be obtained by first measur- 
ing the frequency of the events with a 



17:35 



Table IX. Program to Play a Song. 



$0050 = SONG, [song] = $00 

$0051 = SONG + 1, [SONG + 1] - $Qlt 

$0052 = DOE, [due] - $00 

$0053 = DUE + 1, [DUE + 1] « $08 

$0000 - NOTE (See Note Table) 



HOTE TABLE 
$0000 EC 16 
$0008 66 DF 
$0010 EB 96 
$0018 BA 8i, 
$0020 58 36 
$0028 OB OB 
$0030 07 07 
$0038 Qlt Qlt 
$0040 02 02 



kB 8C 
9 E7 
46 FA 
51 21 
16 F8 

m 09 

(36 06 

04 03 
(2 02 



D8 2D SD F5 
75 QA A5 45 
B2 6E 2F F2 
F4 CA A2 7C 
OE QE OD OC 
09 08 08 (77 
05 05 05 04 
03 03 03 03 
02 02 02 01 



DURATION TABLE 

$0800 01 02 04 08 10 20 10 08 
$0608 04 02 01 C2 04 08 10 20 
$0810 10 08 04 02 01 02 04 08 
$0618 10 20 40 80 40 20 10 08 
$0820 04 02 01 01 00 



SONG TABLE (P:iays scale) 
$0400 OD 01 02 03 04 05 06 cr? 
$0408 08 09aioBccaDaEaF 

$0410 10 11 12 13 14 15 16 17 
$0418 18 19 U IB 10 ID IE IF 
$0420 20 21 22 23 



$0200 A9 CO 


START 


LDA 


:;co 


$0202 SD OB AO 




STA 


JlCR 


$0205 AO 00 




LDY 


:!00 


$0207 Bl 50 


lORE 


LDA 


;soNG),y 


$0209 AA 




TAX 




$02CA B5 00 




LDA 


IIOTE,X 


$C20C SD 06 AO 




STA 


TILL 


$020F 8A 




TXA 




$0210 18 




CLC 




$0211 69 24 




ADC 


J;24 


$0213 AA 




TAX 




$0214 B5 00 




LDA 


ItOTE,X 


$0216 SD 05 AO 




STA 


riLH 


$0219 Bl 52 




LDA 


(DUE),T 


$021B FO 24 




BEQ CUT 


$021D AA 




TAX 




$021E A9 FF 


AGN 


LDA 


$FF 


$0220 8D 08 AO 




STA 


12LL 


$0223 A9 FF 




LDA 


IFF 


$0225 SD 09 AG 




STA 


T2CH 


$0228 A9 20 




LDA 


$20 


$022A 2C OD AO 


BACK 


BIT 


IFR 


$022D FO FB 




BEQ 


BACK 


$022F CA 




DEX 




$0230 DO EC 




BNE a:;n 


$0232 E6 50 




INC 


SDNG 


$0234 DO 02 




BNE 


PIST 


$0236 E6 51 




lUC 


SDNG + 1 


$0236 E6 52 


PAST 


mc 


DJR 


$0e3A DO 02 




BNE 


TffiRE 


$0230 E6 53 




INC 


DJR + 1 


$023E 4C 07 02 


THERE 


JMP 


M3RE 


$0241 A 9 00 


OUT 


LDA 


$X) 


$0243 SD OB AO 




STA 


ai;r 


$0246 00 




BRK 





Initialize ACR to put Tl in free-running 

mode. 

Indirect indexed mode with index = 0. 

Get note I.D. from song table. 

Use it as an index to look up note 

in the note table. 

Put low-order byte into TILL 

Transfer X back to A to find high-order 

byte, which is $24 locations higher 

in page zero. 

Back into X to become index to fetch 

high-order byte of half-jDeriod. 

Result into Tl tijner latch high. Note 

begins to play. Get duration. 

If duration is zero, end of song. 

Duration into X to serve as counter. 

Set up T2 for a time peri.od that determines 

the tempo. 

Start the T2 timer. 

Test to see if T2 has timed— out. 

Is bit five of the IFE set? 

No, wait for it and play note. 

Decrement duration counter until 

it is zero, then note is finished. 

Get another note from the song table. 

If song is zero, then get the next note from 

next page of song table. 

Get another duration from the table. 



Play this note. 

Clear the ACR to finish playing notes. 

Jump to the monitor when finished. 



+5 V 




INPUT I> 
TIMING: 

HJLSES 



Figure 4. Circuit to measure the time interval, 
T, between two successive pii/ses. 



Table X. Program to Measure the Time Between Two Pulsea. 



J 



$C200 A9 00 
$0202 85 01 

$02(x 85 ce 

$0206 85 03 
$0208 A9 01 
$020(1 SD 02 AO 
$02CD 80 00 AO 
$0210 CE 00 AO 
$0213 EE 00 AO 
$0216 A9 10 
$0218 SD OC AO 
$Q21B A9 EO 
$C21D SD Oe AO 
$0220 A9 86 
$0222 SD 06 AO 
$0225 A9 13 
$0227 SD 05 AO 
$022A A9 FF 
$022C SD 08 AO 
$022F SD 09 AO 
$0232 AD 00 AO 
$0235 AD OD AO 

$0238 29 10 

$023A FO F9 
$0230 20 00 03 
$023F CE 00 AO 
$02/t2 EE 00 AO 
$0245 4C 2A 02 

SUBHDUTDfE CNVD 
$0300 38 
$0301 A9 FF 
$0303 ED 09 AO 
$0306 85 11 
$0308 A9 FF 
$03QA ED 08 AO 
$03CB 85 10 
$030F F8 
$0310 AO 10 
$0312 06 10 
$0314 26 11 
$0316 A2 FD 
$0318 B5 04 
$031A 75 04 
$031C 95 04 
$031E E8 
$031F DO F7 
$0321 88 
$0322 DO EE 
$0324 20 40 03 
$0327 A9 00 
$0329 85 01 
$032B 85 02 
$032D 85 03 
$032F 60 



START 



NEXT 



TEST 



CNTO 



MORE 



AGIN 



LDA 


$00 


STA 


LEAST 


STA 


MIDST 


STA 


MOST 


LDA 


$01 


STA 


DDRB 


STA 


PBD 


DEC 


PBD 


INC 


PBD 


LDA 


$10 


STA 


PCR 


LDA 


$E0 


STA 


ACE 


LDA $86 


STA 


TILL 


LDA 


$13 


STA 


TILH 


LDA $FF 


STA 


T2LL 


STA 


T2CH 


LDA 


PBD 


LDA 


IFR 


AND $10 


BEQ TEST 


JSR 


CNTO 


DEE 


PBD 


INC 


PBD 


JMP NEXT 


SEC 




LDA 


$FF 


SBC 


T2CH 


STA 


.CNTHI 


LDA 


$FF 


SBC T2CL 


STA 


CNTLO 


SED 




LDY 


$10 


ASL 


CNTLO 


HDL CNTHI 


LDX 


$FD 


LDA 


DAT.X 


ADC 


DAT.X 


STA 


DAT,X 


IKX 




BNE AGIN 


DEY 




BNE 


MDRE 


JSR AIMDSP 


LDA 


$00 


STA 


LEAST 


STA 


MIDST 


STA 


MOST 


RTS 





Clear display registers. 
Least-significant byte of time. 
Middle byte. 

Most-significant byte of time. 
Initialize PB0 to be an output pir.. 

Initialize PB0 to logic one, then toggle 
it to preset the 7474 flip-flop. 

Set bit four of the peripheral control 

register (PCR) to set interrupt fJag on 

a positive transition on pin CBl. 

Tl in free-running mode, T2 counts pulses. 

Set period of square veve on PB7 so that 

T =0.01 second. 
p 

$1386 + 2 = 5000, so f = 100 Hz, I ■= O.Ols. 

Start square wave running. 

Set up piiLse counter T2 to start at $FFFF. 

Start counting pulses when the event pulse 
clocks the 7474 flip-flop. Clear IFR4 flag. 
Read the interrupt flag register. Ifesk 
all except IKR4. Wait until flag is set, 
then timing is finished, so convert the 
ansvrer to decimal and display it. 
Preset the flip-flop by toggling PB0. 

Measure another interval. 



Set carry for subtractions that follow. 

Find ($FFFF - N,) = number of pulses counted. 



Higii-order byte stored in CNTHI. 

Now get the low-order byte of the count. 

Low-order byte stored in CHTDO. 
Conversion of hex to deciial start.s here. 
Y contains number of bits to conviirt. 
Shift one bit at a time into the carry flag, 

X will serve as a counter for a ti'iple- 
precision addition, with LEAST, MIDST, 
and MDST holding the answer. 

Increment X to zero, then three bytes 

hav« been added. 

DecreiDsnt I until all the bits ha-ve been used. 

When I • 0, conversion is complete. 

Jump to AIM 65 Display Routine. 

Now clear the counter locatitms tc get 

the tine for the next two pulses. 



Return to the tindjig program. 



frequency counter and then applying the 
relation T = 1/f, where T is the time bet- 
ween successive events and f is the fre- 
quency of the events. For low frequency 
periodic events, such as a race, the only 
choice is to measure the time interval 
directly. 

We will assume that the events pro- 
duce positive pulses, and we will not try 
to describe how the positive pulses can 
be produced. Rather, our problem will be 
restricted to measuring the time bet- 
ween two successive positive pulses. A 
circuit and a program to accomplish this 
are shown in Figure 4 and Table X, 
respectively. 

The circuit was inspired by Carlin's 
and Howard's article on the Intel 8253 in 
Computer Design, May 1979, pg. 213. 
The positive pulses clocl< a 7474 flip- 
flop, producing a logic-one voltage at 
the Q output of the 7474 for the time in- 
terval between the leading edges of the 
two pulses. With the Tl timer producing 
square waves on PB7, the logic-one 
voltage on the Q output gates the pulses 
to PB6 (by means of the 7400 NAND 
gate), where they are counted by the T2 
counter/timer. For example, if a square 
wave whose frequency is 10 Hz (T = 0.1 
second) is applied to the 7400 NAND 
gate, and 250 such pulses are counted 
on PB6, then the corresponding time in- 
terval is(250)(0.1) = 25.0 seconds, with a 
resolution of 0.1 second. 

Clearly, no software is required to 
detect the pulses, and consequently 
very narrow pulses can be detected. 
Also, the programmer has control over 
the frequency of the square wave ap- 
plied to the NAND gate. The resolution 
can be changed from 4.0 microseconds 
to 0.10 microseconds by varying the 
number loaded into Tl. 

Refer again to Table VI for a choice of 
frequencies for the free-running mode of 
the Tl timer that might be appropriate 
for a given application. Since the T2 
timer is capable of counting to 65536, 
the maximum time interval that can be 
measured with a square wave whose 
period is T- is: 

Tmax = 65536(Tp) 

= 65536(2)(N + 2)1,, 

where T^gj^ is the maximum time inter- 
val that can be measured, T- is the 
period of the square wave (T- = 1/f) on 
PB7, N is the number loaded into Tl , and 
T(, is the system clock period. 

Refer again to Figure 4. When the se- 
cond pulse occurs, the Q output of the 
7474 flip-flop makes a transition to logic 
one. This also signals the conclusion of 
the timing interval. If Q is connected to 
CB1, the 6522 can be programmed to set 
a flag in the IFR when the logic-zero-to- 
logic-one transition on CB1 occurs. At 
this time the T2 counter/timer can be 
read, the result converted to decimal, 



October, 1979 



MICRO — The 6502 Journal 



17:37 



APPENDIX A. LOW—OVERHEAD CLOCK MODIFICATION 



SUBROUTINE AIMDSP 



$0340 A 5 IDA 01 


$0342 85 STA 04 


$0344 A5 IDA 02 


$0346 85 STA 05 


$0348 A 5 IDA 03 


$034A 85 STA 06 


$034C A2 LDX #13 


$034E 8A TXA 


$034F 48 PHA 


$0350 AO IDY #04 


$0352 A 5 IDA 04 


$0354 29 AND #QF 


$0356 18 CLC 


$0357 69 ADC #30 


$0359 09 ORA #80 


$03 5B 20 JSR EF7B 


$035E 46 LSR 06 


$0360 66 ROR 05 


$0362 66 ROR 04 


$0364 88 DEY 


$0365 DO BHE 035E 


$0367 68 PIA 


$0368 AA TAX 


$0369 CA DEX 


$036A EO CPX #0E 


$036C BO BCS 034^ 


$036E 60 RTS 



and the answer can be displayed or logg- 
ed for the next set of pulses. All of this is 
accomplished with the routines given in 
Table X, a program that was designed to 
operate In conjunction with the circuit of 
Figure 4. An explanation of this program 
follows. 

The largest number of pulses from 
PB7 that can be counted on pin PB6 by 
the T2 counter/timer is $FFFF + 1 or 
65536. Each memory location is capable 
of storing two BCD digits, thus three 
memory locations are required to store a 
number as large as 65536. These three 
memory locations have addresses $0001 
through $0003 in the program shown in 
Table X, and they are used to store the 
decimal equivalent of the count made by 
the T2 counter/timer. The initialization 
steps, display registers cleared, flip-flop 
preset, timers loaded, control registers 
set, etc., require the first $34 bytes in the 
program. After that, the interrupt flag 
register (IFR) is watched to see when a 
positive transition on CB1 occurs. When 
it does, a jump to the conversion 
subroutine, CNVD, occurs. 

The function of the conversion 
subroutine is to convert the contents of 
the T2 counter/timer registers to an ac- 
tual count in decimal. This count 
represents the number of periods of the 
square wave on PB7 that have occurred 
between the events being timed. The 
program in Table X uses a square wave 
whose period is 0.01 seconds, thus the 



0200 78 SflT 


0201 A9 IDA #A0 


0203 8D STA AOOE 


0206 A9 IDA #E0 


0208 8D STA AOOB 


Q2QB A9 IDA #4D 


02CD 8D STA AOO6 


0210 A9 IDA #C3 


0212 8D STA A005 


0215 A9 IDA #57 


0217 8D STA A008 


Q2U A9 IDA #02 


021c 8D STA AOO9 


021F 58 CLI 


0220 4C JMP rC'20 


INTERRUPT 


ROUTINE 0300 A9 IDA #(K 


0302 8D STA AOO9 


0305 18 ck; 


0306 F8 RKD 


0307 A5 IDA 00 


0309 69 ADC #01 


03QB 85 STA 00 


03QD C9 CMP #60 


OSOF DO HNE 0;;24 


0311 A9 IDA #00 


0313 85 STA ai 


0315 18 CIC 


0316 A5 IDA 01 


0318 69 ADC #Cil 


03U 85 STA 01 


03IC C9 CMP #24 


03IE DO BNE 0324 


0320 A9 IDA #C0 


0322 85 STA 01 


0324 D8 CID 


0325 40 RTI 



number of counts in T2 represents the 
number of hundredths of seconds that 
occurred between the two positive 
pulses on the clock input of the 7474 ftlp- 
flop. 

The time between the leading edges 
of the positive pulstis produced by the 
events (call this time T) as measured by 
the program in Table X is given by the 
formula: 

Tm = Tp($FFFF-N2) 

= 2(N., -I- 2)($FFFF - N2)tc 

where T^ is the period of the square 
wave on PB7, N2 Is the number in the T2 
counter/timer at the conclusion of the 
timing interval, and H-^ is the number in 
the T1 timer. Refer to Table VI for the 
necessary N.| to produce a suitable T_. 
Values of Tp that are multiples of ten are 
most useful. The origin of the number 
$FFFF in the equation lies in the fact 
that the T2 counter/timer is loaded with 
$FFFF before timing begins. For the 
listing shown in Table X, Tp is 0.01 
seconds, so the equation becomes: 

T^ = 0.01($FFFF - N2) seconds 

The precision with which one can 
measure the true time T between the 
events depends on the resolution, Tp, 
since clearly the true time need not be 
an exact integral number of Tp. Our 
analysis shows that the actual tinle, T, is 
given by the expression: 



■iy.Tp<T<T^ 



+ VjT^ 



Thus, it greater precision is required, 
then Tp can be reduced. 

The conversion subroutine, CNVD, 
performs the operation ($FFFF - No) 
shown in the equations. To get T, this 
number must be converted to decimal 
and then multiplied by Tp which, in our 
case, is 0.01 seconds. The hexadecimal 
to decimal conversion algorithm used in 
CNVD is from Peatman's book Micro- 
computer Based Design, while the 
coding used is from Butterfield's "Multi- 
Mode Adder" in 6502 User Notes, No. 13, 
pg. 23. 

Subroutine CNVD also calls a 
subroutine named AIMDSP. This routine 
displays the contents of locations with 
addresses $0001, $0002, and $0003; 
namely those locations that contain the 
time T, now in decimal. No attempt has 
been made to locate the decimal point in 
these subroutines. As long as the 
period, Tp, if the square wave on PB7 is a 
multiple of ten, 0.01 second for example, 
the user should have no trouble placing 
his decimal point mentally. 

In any case, subroutine AIMDSP is an 
AIM 65 dependent subroutine that has 
been published previously, so only its 
AIM 65 mini-disassembly format is given 
here. Owners of other microcomputer 
systems will want to substitute a 
suitable routine to display the contents 



17:38 



MICRO — The 6502 Journal 



October, 1979 




TO CLOCK niHJT ON 
THE Iklk FUP-FLOP 



IPBV-^ 



Q +5 7 



12 



L_EB6> 



7490 



<7 



Figure 5. Stopwatch Interface for the Circuit in Figure 4. The s vitch 
is normally closed (N.C.). To produce a pulse when an event oc curs, 
the normally open (N.O.) contact is closed momentarily. 



of the three locations mentioned. Such 
routines for the KIM-1 and SYM-1 are 
readily available. 

The time interval chosen for the listing 
in Table X is suitable for "stopwatch" 
functions, and a suitable stopwatch In- 
terface to the circuit of Figure 4 is given 
in Figure 5. This circuit simply de- 
bounces the switch when it is momen- 
tarily closed at the beginning and the 



end of the interval to be timed. 
Phototranslstor circuits can also be us- 
ed to produce positive pulses when light 
beams are interrupted. A photo- 
plethysmograph can be used to neasure 
the time interval between heartbeats, 
turning the circuit of Figure 4 into a 
cardiotachometer. 

One way to test the circuit of !"igure 4 
and the program in Table X is to apply a 



0200 A9 
02Ce gD 
0205 8D 
Ce08 CE 
CeOB A9 
cecD 8D 
0210 A9 

cei2 an 

Cei5 A9 
cei7 80 
ceu A9 
ceic SD 
ceiF A9 

0221 SD 
0224 A9 
0226 SD 
0229 58 

(Nate: 



IDA #01 
STA A 002 
STA A 000 
DEC A 000 
IDA #E0 
STA AOOB 
IDA #2tD 
STA A 006 
IDA #C3 
STA A005 
IDA #9F 
STA A 008 
IDA #8C 
STA A 009 
IDA #A0 
STA AOOE 
CLI 



Set lap the Port B DDR with a one in bit zero. 

Start with pin PB^ >= 1 to preset 7490. 

Allow 7490 to count. 

Initialize ACR to put Tl in free-running mode, 11 counts 



Frequency of square wave on PB7 = 10 Hz, T = 0. L second. 



Start Tl running. 
Set up T2. 

T = 20(N^ + 2)(N2 + 1)T 

Start counting. 

Set lap interrupt enable register (lEE) to allow in 

interrupt request (IRQ) when T2 times out. 



J 



The interrupt routine should reload T2CH with $8C to clear t le IFH 
and allow counting to proceed again, if equally spaced, lO-hsur 
interrupts are desired, ) 



square wave of known frequency to the 
clock input on the 7474. For example. If 
the pulses from the signal conditioner 
shown in Figure 3 are applied to the 
7474, then the time interval should be 
1/60 of a second. Sfnce 1/60 = 0.01666, 
and if T- = 0.0001 second (N.| = $0030 
from Tfble VI), then the number 1666 
should be displayed for the time bet- 
ween successive positive pulses. Be 
sure to change the bytes at $0221 and 
$0226 to $30 and $00, respectively, in 
Table X if you make this test. 

Finally, If an event can be made to pro- 
duce a single positive pulse for its dura- 
tion, the length of the event may be 
measured using a slightly modified form 
of the program in Table X and the circuit 
shown in Figure 6. 

In conclusion I should like to point out 
that the programs and circuits given are 
the simplest ones I could construct. You 
will want to add more elegant features. 
The purpose of this article was to in- 
troduce a few basic techniques, not to 
present elaborate designs. If you come 
up with a neat design as a result of 
something you learned here, I would be 
very interested in getting a letter from 
you. Better yet, write up your circuit and 
program and publish both in MICRO. 
Although the circuits and programs 
described here were intended to be 
building blocks for more elaborate 
microprocessor based designs, the stop- 
watch interface and timing program 
could be used for "time and motion" 
studies around the house. Just make 
sure your spouse's motions do not make 
you lose track of the time! 

Editor: Portions of this article are from 
Dr. De Jong's forthcoming bool( ten- 
tatively entitled 6502 Microcomputing, 
to be published by Howard W. Sams and 
Company, and scheduled for release 
later this autumn. 



October, 1979 



MICRO ~ The 6502 Jouinal 



17:39 




inc. 



BOX 120 

ALLAMUCHY, N.J. 07820 

201-362-3574 



HUDSON DIGITAL ELECTRONICS INC 

THE HDE MINI-DISK SYSTEM 




VERSIONS 

KIM 

TIM 

AIM 65 -4th Qtr. '79 

SYM - 1 St Qtr. '80 



SINGLE DRIVE 
DUAL DRIVE 



$ 795.00 
$1195.00 



Complete with all hardware. 
Interconnecting cables, FODS, 
text editor and user and instal- 
lation manuals. 



The HDE DM81 6-MD1 Mini Disk System is the per- two-pa; 

ipheral you have been waiting for. No longer bounded Systerr 

by long and unreliable cassette saves and loads, your eludes 

computer becomes a sophisticated system for program state-o( 

development or general purpose use. With the HDE and the 
Mini-Disk you load and save programs in seconds, not The 

minutes or hours. And, since all transfers to and from dard, Si 

the Mini-Disk are verified for accuracy, the data will be at mos 

there when you need it. system 

The HDE DM81 6-MD1 Mini-Disk has been "systems" transac 

engineered to provide a complete and integrated capa- format! 

bility. Software and hardware have been built as a team diskett 

using the most reliable components available. The sys- R/W te 

tems software includes the acclaimed and proven provide 

HDE File Oriented Disk System and Text EDitor, requir- disk p; 

ing only 8K for the operating software and overlay area. file adc 
Systems expanding programs available include the 



s HDE assembler, the Text Output Processing 

and Dynamic Debugging Tool. Hardware m- 

a Western Digital 1771 based controller in a 

■the-art 4V2 x 6V2" card size, Shugart SA 400 drive 

Alpha power supply. 

storage media for the DM81 6-MD1 is the stan- 
)ft sectored S'A" mini diskette readily available 
computer stores, and HDE has designed the 
so that the diskettes rotate only during disk 
tions, favorably extending media life. A disk 
3r routine included with the system, formats the 
!S, verifies media integrity by a comprehensive 
3t and checks drive RPM. Additional utilities 
ascending or descending alpha numeric sort, 
eking, text output formatting, file renaming, 
ressing and other capabilities. 



HDE PRODUCTS. BUILT TO BE USIED WITH CONFIDENCE. 
AVAILABLE DIRECT OR FROM THESE FINE DEALERS: 



JOHNSOI^ COIVIPUTER PLAiNSIVlAN MICROSYSTEMS 
Box 523 Box 1712 

Medina, Ohio 44256 Auburn. Ala. 36830 

216-725-4560 800-633-8724 



ARESCO 

P.O. Box 43 

Audubon, Pa. 19407 

215-631-9052 



LONG ISLAND 

CO yIPUTER GENERAL STORE 

103 Atlantic Avenue 

Lynbrook. N.Y, 11563 

516-887-1500 



LONE STAR ELECTRONICS 

Box 488 

Manchaca, Texas 78652 

612-282-3570 



Card Shuffling Program for KIM - 1 



Your 6502 might play poker like Amarillo KIM, but does it 
always have to pass the deal? Not if you teach it to 
shuffle cards! 



Hark Chan 

P.O. Box 714 

Cambridge, MA 02139 



J 



Entertaining friends with computer 
games certainly makes all the effort of 
assembling a personal computer worth- 
while. However, if you happen to have a 
small microcomputer with limited mem- 
ory and very few software tools, there 
are not many games available. As an 
example, most card games need a ran- 
dom number generator to shuffle cards. 

The standard method to generate ran- 
dom numbers (as used in most BASIC 
interpreters) is not suitable for this pur- 
pose. Since some of the bare-bone com- 
puters do not even have the software to 
perform multiplication, it is asking too 
much for them to generate floating- 
point random numbers. To make these 
small computers more entertaining, a 
simple method to shuffle cards is de- 
scribed here. This method is implement- 
ed in a KIM. The machine instructions 
use about 80 bytes. There is lots of mem- 
ory left for playing card games. The only 
drawback is that it requires the operator 
to press the interrupt key in order to stop 
the program. 

The card shuffling program consists of 
two portions. The second portion is the 
main program that shuffles cards. It just 
keeps on shuffling until the interrupt key 
is pressed. The first portion is an inter- 
rupt service routine used to ensure an 
orderly ending of the program. The pro- 
gram is relocatable, and the two portions 
can be in separate locations. 

This feature makes it easy to incorporate 
the shuffling program into a complete 
card-playing program. However, it is im- 
portant that the user initialize the inter- 
rupt vectors to jump to the interrupt ser- 
vice routine. 

To keep the computer code relocatable, 
the initialization of the 2 byte address is 
left to the user. The storage area for the 
cards, together with 4 bytes of working 
space, are in page 0. In this program, the 
storage area starts at address 0001. 
However, the program can be changed 
easily to move the storage area to other 
locations in pageO. 

The deck of cards is stored in an array at 
locations (hex) 0001 to 0034. The value of 



0120: 


0200 






ORG 


$0200 


0130: 


0200 


A2 


36 


LDXIM 


$36 


omo: 


0202 


8A 


LI TXA 




0150: 


0203 


95 


00 


STAZX 


$00 


0160: 


0205 


CA 




DEX 




0170: 


0206 


DO 


FA 


BNE 


LI 


0180: 


0208 


86 


38 


STXZ 


$38 


0190: 


020A 


A5 


35 LOOP LDAZ 


$35 


0200: 


020C 


38 


L 


2 SEC 




0210: 


020D 


E9 


34 


SBCIM 


$34 


0220: 


020F 


BO 


FB 


BCS 


L2 


0230: 


0211 


18 




CLC 




0240: 


0212 


69 


35 


ADCIM $35 


0250: 


0214 


AA 




TAX 




0260: 


0215 


85 


35 


STAZ 


$35 


0270: 


0217 


B5 


00 


LDAZX 


$00 


0280: 


■0219 


85 


37 


STAZ 


$37 


0290: 


021B 


A5 


36 


LDAZ 


$36 


0300: 


02 ID 


OA 




ASLA 




0310: 


021E 


OA 




ASLA 




0320: 


021F 


18 




CLC 




0330: 


0220 


65 


36 


ADCZ 


$36 


0340: 


0222 


18 




CLC 




0350: 


0223 


69 


01 


ADCIM 


$01 


0360: 


0225 


85 


36 


STAZ 


$36 


0370: 


0227 


18 




CLC 




0380: 


0228 


65 


35 


ADCZ 


$35 


0390: 


022A 


38 


L3 SEC 




0400: 


022B 


E9 


33 


SBCIM 


$33 


0410: 


022D 


BO 


FB 


BCS 


L3 


0420: 


022F 


18 




CLC 




0430: 


0230 


69 


34 


ADCIM 


$34 


0440: 


0232 


AA 




TAX 




0450: 


0233 


B4 


00 


LDYZX 


$00 


0460: 


0235 


A5 


37 


LDAZ 


$37 


0470: 


0237 


95 


00 


STAZX 


$00 


0480: 


0239 


A6 


35 


LDXZ 


$35 


0490: 


023B 


94 


00 


STYZX 


$00 


0500 : 


023D 


A 5 


38 


LDAZ 


$38 


0510: 


023F 


C9 


00 


CMPIM 


$00 


0520: 


0241 


FO 


C7 


BEQ 


LOOP 



October, 1979 



MICRO — The 6502 Journal 



17:41 



0010: 








0020: 








0030: 








0040: 


0243 


A5 


F3 


0050: 


0245 


A4 


F4 


0060: 


0247 


A6 


F5 


0070: 


0249 


E6 


38 


0080: 


024b 


40 





» INTERRUPT SERVICE ROUTINiil 

LDAZ $F3 

LDYZ $F4 

LDXZ $F5 

INCZ $38 
RTI 



Initialize Interrupt 
vector to address of 
service routine 



Initialize card array 
and page zero, work 
space. 



each address is distinct and is between 
hex 1 to 34 (decimal 1 to 52). After the in- 
terrupt key is pressed, the content of 
these addresses represents a deck of 
random cards. 

The program uses a simple random num- 
ber generator to generate random point- 
ers with values between 1 and 52. The 
first card in the deck is interchanged 
with the card selected by the random 
pointer. The position of all the cards is 
next shifted one place so that the last 
card becomes the first, the first card 
becomes the second, and so on. This is 
to make sure that the first card is always 
changing, and a different card is inter- 
changed with each randomly selected 
card. A random pointer is again 
generated and the whole operation is 
repeated. 

After a sufficient number of operations, 
the deck is suitable for card games. One 
or two hundred shufflings are sufficient. 



When the interrupt key is pressed, the 
interrupt service routine sets a nemory 
location, hex 0038, that serves as a flag 
to signal the end of the shufflirg. This 
routine also restores the accu nulator 
and the X and Y registers. It is im sortant 
that the user initialize the interrupt vec- 
tor to address the service rou ine in- 
stead of the operating system. 



The sequence of cards being shuiHed is 
actually predetermined becausf it is 
calculated from a prescribed se ies of 
operations. However, If the sto|i com- 
mand is activated by a human operator 
the cards can be very random. I takes 
about 10" second to do one shuffle. 
The time to activate the stop command 
can easily vary by more than 0.1 Sijcond. 
Thus, the number of shufflings Dan be 
uncertain by about 1000, which s suf- 
ficient to generate a deck of r mdom 
cards. 




Interrupt 

Key 

Pressed 



Restore accumulator 
Restore X register 
Restore Y register 

Set flag to 1 

Return from interrupt 



KIIVt/SYIVI/AIM-65-32K EXPANDABLE RAM 

DYNAMIC RAMWITHONBOARDTRANSPARANT REFRESH 
THAT IS COMPATIBLE WITH KIM/ SYM/AIM-65 
AND OTHER 6502 BASED MICROCOMPUTERS. 




' PLUG COMPATIBLE WITH KIM.'SYM/Allli«. 
MArBECONNECTEDTOPETUSINGAOAF FOR 
CABLE. SS44-E BUS EDGE CONNECTOR 

• USES ♦SV ONLY (SUPPLIED FROM HDST 
COMPUTER BUS). 4 WAHS MAXIMUM. 

' BOARD ADDRESSABLE IN 4K BYTE BLOIKS 
WHICH CAN 8EINDEPENDENTLYPUCEI ION 
4K BYTE BOUNDARIES ANYWHERE IN A >4K 
BYTE ADDRESS SPACE. 
BUS BUFFERED WITH 1 LS TTL LOAD. 
20ONSEC 4116 RAMS. 
FULL DOCUMENTATION 

• ASSEMBLED AND TESTED BOARDS iRE 
GUARANTEED FOR ONE YEAR, I NO 
PURCHASE PRICE IS FULLY REFUNDABl I IF 
BOARD IS RETURNED UNDAMAGED WI1I1IN 
14 DAYS. 

ASSEMBLED/ 
TEJ TED 



KIT 



WITH 32K RAM t4{ll00 M58.00 

WITH 16K RAM t4:ii.0a 1389.00 

WITHOUT RAM CHIPS S3Sli.OO 1319.00 

HARD TO GET PARTS ONLY (NO RAM CHIPS) 1180.00 

BARE BOARD AND MANUAL I85.0O 



m 



mm 



CONNECTS THE ABOVE 3ZK EXPtWOABLE RAM Til A 4K OR SK PH. 
CONTAINS EXPANSION INTERFACE CABLE. BIIARO STANDOFFS. 
POWER SUPPLY MDOIFICATION KIT ANO COMPLITE INSTRUCTIONS 



BETA COMPUTER DEVICES 

P.O. BOX 3465 
ORANGE. CALIFORNIA 9;!665 

(714) 633.7280 



ALL ASSEMBLED aOAHDS ANO MEM- 
ORY CHIPS CARRY A FULL ONE YEAH 
REPLACEMENT WAKANTY. 



I6K XI DYNAMIC RAM 

THE MK4116-3 IS A 16,384 BIT HIGH SPEED 
NMOS. DYNAMIC RAM. THEY ARE EQUIVALENT 
TO THE MOSTEK, TEXAS INSTRUMENTS, OR 
MOTOROLA 4116-3. 

• 200 NSEC ACCESS TIME, 375 NSEC CYCLE 
TIME. 

• 16 PIN HL COMPATIBLE. 

• BURNED IN AND FULLY TESTED. 

• PARTS REPLACEMENT GUARANTEED FOR 
ONE YEAR. 

».aOEACHIN(IUAIITITIES0F8 



MOTOaOLA MEMORY A0DIIE88 MULTIPLEXER- 
MC3242A 

THE MC 3242A IS AN AOOfiESS MULTIPLEXER 
ANO REFRESH COUNTER FOR 16 PIN. 16K 
DYNAMIC RAMS THAT REQUIRE A 128 CYCLE 
REFRESH 

• CONTAINS MEMORY REFRESH COUNTER. 

• MULTIPLEXES SYSTEM 14 BIT ADDRESS TO 
THE 7 ADDRESS PINS OF THE RAMS. 

» COMPATIBLE WITH 3480 MEMORY 
CONTROLLER. 

• PART IS GUARANTEED. 

II2J0EACH 



MOTOHOLA DYNAMIC MEMORY CONTHOLLEH- 
MC3480L 

MEMORY CONTROLLER OESIGNEDTOSIMPLIFY 
CONTROL OF 16 PIN 4K OR 16K DYNAMIC RAMS. 

• GENERATES RAS/CAS ANO REFRESH TIMING 
SIGNALS FOR 16K T064K BYTE MEMORIES. 

» GENERATES MEMORY READ/WRITE TIMING, 

• DIRECT INTERFACE WITH MOTOROLA OR 
INTEL 3242A ADDRESS MUX AND REFRESH 
COUNTER. 

• PART GUARANTEED. 

:i 3.1)6 EACH 



6302. S4K BYTE HAM AND CDNTHOLLEH SET 

MAKE 64K BYTE MEMORY FOR YOUR 6800 OR 
6502. THIS CHIP SET INCLUDES: 
»32M5K4116-3 16KX1, 200 NSEC RAMS. 
» 1 MC3480 MEMORY CONTROLLER. 

• 1MC3242A MEMORY ADDRESS 
MULTIPLEXER AND COUNTER. 

• DATA AND APPLICATION SHEETS. PARTS 
TESTED ANO GUARANTEED. 

S32S.00 PER SET 



EPROM 

2716-450NSEC MS.OO 



How Do You Connect Peripherals 
to Your Superboard II 



The OSI Superboard has a wealth of I/O ports, but often 
the effective use of them is "Left as an exercise for the 
reader". Here is some concise information on tlie con- 
figuration and use of the I/O ports. 



Bruce Hoyt 

Route 1 

Brighton, TN 38011 



J 



Since I wrote "A Close Look at the 
Superboard II", MICRO 11:15, I have 
received severai calls and letters asking 
for more Information concerning Inter- 
facing the Superboard il to various 
peripherals — printers, memory boards 
and so on. Because of the continuing 
lack of information available from OSI, 
the manufacturer of the Superboard and 
the Challenger IP, I have decided that It 
would be good to give some basic and 
rather general pointers on the use of the 
Superboard ports. 

Since there are many different 
peripherals (understatement of the cen- 
tury) and since each one has its own 
requirements, I cannot be very specific 
about your particular device, instead, I 
hope to describe the signals available 
on the Superboard In some detail, so 
that you will at least know something 
about its interfacing possibilities. 

The J2 Port 

There are four ports on the Super- 
board. Three of them are 12-pin Molex 
connectors and one of them is a 40-pin 
DIP socket. They are numbered J1 
through J4. i shall begin with J2, since 
you are already using that one to inter- 
face your video monitor and your 
cassette. You will find a listing of the pin 
outs for J2 In Figure 1. Pins 7 through 10 
are used for the cassette. Pins 11 and 12 
are used for the video output. 

I assume that you understand the 
basic use of these pins; and so, I will on- 
ly mention that the signals generated for 
the cassette come from an on-board in- 
terface consisting of a Motorola 6850 
ACIA and a couple of flip flops (U64). The 
audio input goes through an RCA 3130 
which triggers a monostable one-shot 
and sets or resets a flip flop. This signal 
is then fed to the 6850. 

The signals at the 6850 are designated 
as RxData and TxData. The 6850 also 
has two control signals which are not 



used by the cassette Interface l:ut might 
be useful to your peripheral, "hey are 
designated as RTS and CTS on the 
schematics. 

Finally, there are two separate clocks 
which drive the 6850: TxCLK anc RxCLK. 
These clocks set the baud rate at which 
the 6850 operates. For precise in forma- 
tion on the 6850, 1 suggest that > ou get a 
copy of the manufacturer's spue sheet 
on this ACIA. Your dealer should have it. 
I mention all of this simply Decause 
these six signals are present as TTL 
signals on J2, pins 1 through 6. If your 
peripheral requires TTL level serial data, 
then you will connect It to thesis pins. 

But there Is more to it than just con- 
necting your peripheral's cabUi to the 
right pins on J2. My Superboard II came 
with several parts missing. You \i^ill need 
to install a 7417 at U68 and a 7'LS14 at 
U67. You will also have to Instal the 220 
and 390 ohm resistors at R38 through 
R49. 

Next, notice that the RxData and CTS 
signals coming in on pins 1 and 3 
respectively are called RxData3 and 
CTS3 after they come from U67. "hey are 
then routed to jumper locations WIO (the 
upper WIO to the right of Q2 In the 
schematic sheet 6) and W11. The reason 
for this Is that you don't want input com- 
ing from two or three different sources 
going to the 6850. 

I recommend that you install a DP3T 
(double pole three throw) switch so that 
you can switch the RxData line cioing to 
the 6850 between RxDatal, which is the 
cassette input; RxData3, which is the 
TTL level input from J2; and the RS-232 
input which will be described shortly. 
The other pole of this switch can be 
used to switch CTS appropriately. To in- 
stall this switch you only have to cut the 
trace connecting the RxData Wwi to Rx- 
Datal at WIO. 

With this switch Installed, you can 
switch lines between three sourc^ss of in- 



put: the cassette, your peripheral on TTL 
level lines at J2, and some other 
peripheral that uses RS-232 on J3. 

One more change may be needed at 
jumper location W5, also on sheet six of 
the schematic. Here, the TxCLK is wired 
to the RxCLK. To separate them, you 
merely have to cut the diagonal trace 
connecting them and install another 
switch to switch the RxCLK line on the 
6850 between the TxCLK line and the Rx- 
CLK Input. 1 recommend, however, that 
you not make this modification unless 
you need separate clocks for your 
peripheral, if your peripheral is pretty 
stable and close to 300 baud, you can 
probably get by as is. But if you have a 
peripheral that has a clock rate different 
from 300 baud, you will need to make 
this modification. 

You may now ask what the RTS and 
CTS signals are used for. If your 
peripheral is a printer, it may send out a 
busy signal whenever it is not ready to 
receive another character. This signal 
should be active high. It should be con- 
nected to the CTS on the 6850 — that is, 
It should be connected to J2 pin 3. You 
will have to switch W11 properly, since 
the CTS goes through this junction. You 
may also have a TTL line which controls 
the power on/off on your peripheral. 
Maybe you would like to control the 
cassette motor. You can do this with the 
RTS signal. It is a signal provided by the 
6850 under software control; that is, 
your software, since OSI doesn't sup- 
port this function. 

Because It is fed through a 7417 buffer 
which is capable of sinking 30 
mllliamps, you can use it to drive a small 
reed relay. I purchased just such a relay, 
which operates on 5 volts at about 20 
mllliamps, and have used it to turn my 
cassette on and off. See Figure 2 for a 
schematic used to connect a relay to the 
RTS signal. 

Now all the connections are made, but 
how do you Instruct the computer to 



October, 1979 



MICRO ~ The 6502 Journal 



17:43 



transmit and receive tliese signals? 
Remember tliat tlie cassette is also con- 
nected to the 6850; and so, as far as soft- 
ware is concerned, the peripheral will 
work just like the cassette. Whatever 
you write to your cassette will go to the 
TxData line and to your peripheral. You 
read your peripheral just as you would 
read from the cassette (after you switch 
W10 over). 

Let us suppose that you have a printer 
connected to the TxData line and that it 
sends a busy signal back over the CTS 
line when it is working. Whenever you 
give the command to "SAVE" In BASIC, 
this will activate the printer just as it 
does the cassette, so that any 
characters output by BASIC will be sent 
to both printer and cassette. If either of 
them is turned on, it will print or record 
the data sent. And how can one tell 
whether the printer is busy or not? You 
can't without writing some of your own 
software. 

You see, Miicrosoft BASIC does not 
actually do any I/O; it merely jumps out 
to the I/O routine provided by OSI in the 
monitor. There are four routines that 
BASIC jumps to for I/O: one which inputs 
a character, one wtiich outputs a 
character, one which is executed 
whenever the LOAD command is given, 
and one which is executed whenever the 
SAVE command is given. BASIC jumps 
to the following addresses which have 
instructions as shown; 



Input FFEB JMPI $0218 

Output FFEE JMPI $021A 

Load FFF4 JMPI $021 E 

Save FFF7 JMPI $0220 

The monitor stores the addresses of 
the input, output, load, and save 
routines at the locations $0218, $021A, 
$021 E, and $0220 respectively every time 
the BREAK key is pressed. This makes 
BASIC transfer control to these routines 
when it needs I/O. 

Of course, it would be easy to write 
your own routine and POKE the address 
of it in one of these locations so BASIC 
would then jump to your routine instead 
of the one in the monitor. You can 
disassemble the routines in the monitor, 
if you want to find out just what they do, 
but I will describe their functions here. 

The input routine, located at $FFBA, 
checks the load flag at $0203. If it is 
zero, the routine jumps to the keyboard 
input routine at SFDOO to input a 
character from the keyboard. If the flag 
is non-zero, the input routine checks to 
see if the spacebar Is pressed and, if 
not, it inputs one character from the 
6850 and returns. If the spacebar is 
pressed, it sets the load flag to zero and 
inputs a character (which will be a space 
since the spacebar is pressed) from the 
keyboard. This is why pressing the 
spacebar will stop reading from the 
cassette. 

17:44 



The output routine, located at $FF69, 
jumps to the CRT simulator routine at 
$BF2D which outputs a character to the 
screen and then checks the save flag at 
$0205. If the save flag is it returns. If 
the save flag is non-zero, it outputs the 
character to the 6850. If this character 
was a carriage return (that is, $0D) then 
it also sends out 10 nulls ($00). 

The load routine, located at $FF96, 
sets the save flag to 1. When you give 
the SAVE command, BASIC jumps to the 
save routine which sets the save flag. 
Then, whenever you output any 
character, BASIC jumps to the output 
routine which" sends the character not 
only to the CRT, but also to the 6850. 
This will send it to the cassette and also 
to your printer. If you don't turn on your 
cassette, the character will only be 
printed by the printer. 

But I still haven't described how you 
know when the printer is busy. You can 
PEEK at the 6850 control status register 
to see whether the CTS bit is low. Then 
you will know the the printer is ready. 
But this is not a very good way to do it, 
since you would have to do such PEEK- 
ing prior to every print command! The 
better way is to write a short output 
routine which checks this bit for itself. 

The 6850 occupies two address loca- 
tions: $F000 and $F001. The first of 
these is the control register of the 6850 
and, by writing and reading this address, 
one can send and receive control 
signals. $F001 is the data register and, 
by writing or reading this address, one 
can send and receive data from the 6850. 



The short output routine shown here 
illustrates how one might check for a 
printer busy signal. The listing includes 
two small programs that turn the RTS 
signal off and on. The latter might be 
employed to write a SAVE routine that 
could be called from BASIC and would 
turn the cassette or printer on 
automatically. Remember that you will 
have to put the addresses of your I/O 
routines in locations $0218, $021A, 
$021 E and $0220 after each time you 
depress the BREAK key. 

The J3 Port 

The main purpose for J3 is to interface 
peripherals which require RS-232 
signals. As can be seen in Figure 1, pins 
2 and 3 are the data out and in pins. Pin 7 
provides a negative voltage for the 
RS-232 interface. To use this, however, 
you will have to open the ground at 
jumper W10, the lower one under Q1. 
Even more than this, you will have to in- 
stall all the hardware for the RS-232 
signal level generation; that is, 01 and 
02 and their associated resistors and 
diode. Once again you must set up W10 
and W11 with the proper switch, as 
described previously, so that you can 
switch between the cassette and your 
peripheral. I believe that the description 
for J2 was sufficient to get you going on 
the software you might need to use this 
port. 

The J4 Port 

In the OSI manual on the Superboard, 
J4 is described as a "joystick" and 
"noise" port. The noise is made by turn- 
ing on and off four of the keyboard 



1 

* 


2 


< 

< 


3 

1 « 


8 

1 < 


7 

1 


6 5 


t 3 

T T 


J2 




M ^ 


[2 " 


ri 


pT*"" 


r 


r 


p7 








8 


9 


10 








Figure 4 



1N9Tt 



Figure 2 



J2 PIN 6 



RTS 




Q +5 V 




MICRO — The 6502 Journal 



CASSETTE 

REMOTE 

PLUG 



October, 1979 



J1 



Figure 1: Superboard I/O Ports 

J2 



Pin 

1 
2 


Signal 

IRQ 
NMI 


3 


DD 


4 


BDO 


5 


BD1 


6 


BD2 


7 


BD3 


8 


GND 


9 


GND 


10 


GND 


11 


unused 


12 


A2 


13 


A1 


14 


AO 


15 


A3 


16 


A4 


17 


A5 


18 


A6 


19 


A7 


20 


A8 


21 


A9 


22 


A10 


23 


All 


24 


A12 


25 


A13 


26 


A14 


27 


A15 


28 


GND 


29 


GND 


30 


GND 


31 


02 


32 


R/W 


33 


BD7 


34 


BD6 


35 


BD5 


36 


BD4 


37 


GND 


38 


GND 


39 


GND 


40 


GND 



Pin 

1 


Signal 

RxData 


2 
3 


RxCLK 
CTS 


4 


TxData 


5 
6 


TxCLK 
RTS 


7 


Mic .05 volt 


8 


GND 


9 


AUX 0.5 volt 


10 


Audio in 


11 


GND 


12 


Video out 



J3 



Pin 


Signal 


1 


GND 


2 


RS232 out 


3 


RS232 in 


4 


RxData 


5 


RxDatal 


6 


RxData2 


7 


-V in for RS232 inteface 


8 


unused 


9 


CTS 


10 


CTS2 


11 


unused 


12 


unused 



J4 



Pin 


Signal 


1 


R1 


2 


R7 


3 


CI 


4 


C2 


5 


C3 


6 


4 


7 


C5 


8 


C6 


9 


C7 


10 


R6 


11 


GND 


12 


Noise 



) 



latches. These are coupled through 
resistors and a capacitor to pin 12 of J4. 
The main problem is that the resistors 
are not installed, nor are their values 
given. I have not experimented enough 
with these to determine what values 
would work best to give four bit analog 
output. 

The main reason I have not done this 
experimentation is that I have not 
thought the "noise" would be very 
useful because it is coupled to the 
keyboard. For this reason, whenever the 
keyboard input routine is called, a tone 
is generated by a loop in that routine 
which sets and resets the keyboard lat- 
ches. 

If you wanted to produce some music, 
you could do so by choosing proper 
values for these resistors and then 
writing a small program to turn on and 
off these latches by writing to address 
$DFOO. I would advise installing a switch 
between the output of pin 12 and your 
amplifier since you will want to turn off 
this noise whenever you are not 
generating some music or gaming 
sound effects. The keyboard routine's 
continuous tone is rather annoying after 
a while! 

if you want a beeper to signal various 
conditions audibly, then I recommend 
that you use the RTS output at J2. It 
comes from a heavy buffer which could 
be connected through a 100 ohm 
resistor and a small speaker to the 5 volt 
line. When this RTS signal is turned on 
and off at the proper rate, it would make 
a nice beeper without the need for the 
amplifier tfiat the output at J4 pin 12 re- 
quires. Also, there would be no annoying 
continuous tone. 

The other pins on J4 are quite useful 
because they are connected directly to 
the keyboard matrix. The graphics 
manual has a short description of how 
to deactivate the CTRL-C routine and 
how to check for a key depressed. If you 
were to connect lines 1 through 11 on J4 
to some switches, you could use the pro- 
cedure to determine whether the swit- 
ches were closed. In this way, one might 
simulate a joystick. 

By using four switches you could in- 
dicate eight directions. North, east, 
south and west could be indicated when 
exactly one switch was closed — the 
switch in that particular direction on 
your joystick. Northeast, southeast, 
southwest and northwest could be in- 
dicated by two adjacent switches being 
closed at the same time. By this means 
you could move a point on the screen in 
any of eight directions. 

Another very good use for these lines 
would be to add a numeric keypad in 
parallel with the keyboard. To do so, you 
need only wire tlie switches on the 
keypad so they are in parallel with the 
corresponding keys on the keyboard as 
shown in the schematic, sheet 12. See 



October, 1979 



MICRO — The 6502 Journal 



17:45 



Figure 4 for a diagram of these switcnes. 
By doing this and writing a short BASIC 
program, you could imitate a very power- 
ful calculator. 

The J1 Port 

This port is what OS! uses for expan- 
sion. It has all the data and address 
lines in addition to several of the control 
lines that the 6502 produces. I sug- 
gested in my previous article that this 
socket could be connected to a KIM type 
connector to make a KIM expansion 
port. That is more or less true but, as you 
will see from checking the signals 
available on J1 and the required signals 
on the KIM expansion port, there are a 
few missing. The most important ones 
are there, and it just may be that the 
ones you need to operate your 
peripheral memory board or whatever 
are present. 

Pin 3, the DD line, needs some ex- 
planation. This line is an incoming 
signal that is used to control the data 
buffers U6 an d U7 . This line must be 
driven by the R/W signal, s o I s uggest 
that you connect both the R/W signal 
(that you get from U2 1 pin 6) and the line 
from J1 pin 3 to the R/W pin on the KIM 
expansion connector. 



I think a 40 wire ribbon cable with a 
DIP plug on the end of it wou d be the 
best thing to make the connec ion from 
J1 to the KIM connector. O course, 
some of the wires won't be usei 1; and so, 
you might be able to pull some of the 
unused wires out and solder th im to the 
points on the Superboard whers you are 
going to get the missing signa s. 

The missing signals can be found at 
the following places: R/W on U21 pin 6 
as mentioned above, 02 on U !1 pin 4, 
RSf on the high (non-ground) si de of the 
BREAK key, VCC where the r id 5 volt 
supply line enters the board, \/SS any 
place along the edge of the boe rd where 
the ground plane is, SYNC on J8 pin 7, 
and 01 on U8 pin 3. If you need the RDY 
signal, you have to make a cf ange on 
the Superboard. Open the sh )rt trace 
coming from U8 pin 2, which is the RDY 
line on the 6502, and put a 4.7K pull up 
resistor in the opening you ha' e made. 
This will enable any periphf ral that 
needs to use the RDY line to pull it low. 
After installing the resistor, you can wire 
the RDY line to US pin 2. 

There are also RO, K6, SiiT OUT, 
RAM/R/W, and PLL TEST linei on the 
KIM expansion connector, but y du won't 
be able to get these from th s Super- 



board. 1 doubt that any of the peripherals 
you might be interested in will require 
them since they are rather peculiar to 
the KIM. 

This method of directly wiring a KIM 
socket to the appropriate signals on the 
Superboard will give you a workable KIM 
expansion connector even though it may 
look a little messy since you have to run 
wires to several points on the Super- 
board. If you plan to use several boards 
simultaneously, you will want to make 
your connections to a KIM compatible 
motherboard. 

You may ask if all this wiring is worth 
the effort, since OSI sells a 610 expander 
board which plugs directly into the J1 
socket and which will then connect to 
the OSI 48-pin bus. I think that it is 
because I like to work with hardware and 
software together. OSI doesn't offer 
everything that I need, and their price is 
somewhat high for what I want. You may 
wish to investigate just what OSI offers 
in the way of peripherals before you 
make any of these changes and addi- 
tions to your Superboard. In any case, I 
hope that you now understand a little 
more about how your Superboard works 
and how you might go about connecting 
some peripherals to it. 




Pygmy 
Programming 



* PRESENTS ' 



APPLE BUSINESS SOFTWARE 

APPLE-DMS© 48k & disk required $49.00 

Apple data management system ... the ultimate in free- 
form systems. You define the name and length of fields 
within each record. Multi disk capability gives you access 
to thousands of records at once with the included 
sort/edit features! The print format is also defined by the 
user for custom report generation. Uses include mailing 
labels, inventory, personnel data and other record 
keeping functions. 

APPLE-SCRiBE-2© disk or cassette $49.00 

Text processor ... the perfect addition to any business 
system. This is a non-line oriented editor that allows 
upper and lower case letters, any width paper and any 
length page. Included features are automatic headings, 
date and page number, right hand justification, search 
with universal or individual replacements. Text is stored 
on disk or cassette for easy retrieval. 

P.O. Box 3078 • Scottsdale, AZ 85257 



PRINT 


CRG 


(Wherever you want it) 


CRT 


EQU 


$BF2D 




STATUS 


EQU 


$F000 




DATA 


EQU 


$F001 




SAVFLG 


EQU 


$0205 






:sR 


CRT 


OUTPUT TO CRT 




FHA 




SAVE CHARACTER 




LDA 


SAVFLG 


CHECK SAVE FLAG 




BEQ 


RTN 


IF NO 6850 OUTPUT 


WAIT 


LDA 


STATUS 


WAIT FOR 




L5RA 




CHARACTER 




L5RA 




TO BE TRANSMITTED 




BCC 


WAIT 




WAITl 


L3A 


STATUS 


WAIT FOR 




AVDIM 


$08 


PRINTER 




BVE 


WAITl 


READY 


READY 


P-A 




WHEN READY 




STA 


DATA 


OUTPUT DATA 


RTN 


RTS 






CASOFF 


L3AIM 


$51 






STA 


STATUS 






RTS 






CASON 


DAIM 


$11 






STA 


STATUS 






Rrs 




Fiaure 3 



17:46 



MICRO ~ The 6502 Jounal 



October, 1979 



WE'VE GOT 
YOUR CXMVIPUTER 



J 



CI Pi $349! a dramatic breakthrough in price and per- 
formance. Features OSI's ultra-fast BASIC-in-ROM, full graphics 
display capability, and large library of software on cassette and 
disk, including entertainmentprograms, personal finance, 
small business, and home applications. It's a complete pro- 
grammable computer system ready to go. Just plug-in a video 
monitor or TV through an RF converter, and be up and running. 
1 5K total memory including 8K BASIC and 4K RAM — 

expandable to 8K. 



C1 P MFl $995! First floppy disk based computer 

for under $1000! Same great features as the CI P plus more 

memory and instant program and data retrieval . Can be 

expanded to 32K static RAM and a second mini-floppy. 

It also supports a printer 

modem, real time clock, 

and AC remote interface, 

aswellasOS-65D 
V3.0 development 
disk operating 
system. 





Lr^"4r ! ^d^O! The professional portable that has over 3-times the display 
capability of 1 P's. Features 32 x 64 character display capability, graphics, full 
computer type keyboard, audio cassette port, and 4 slot BUS (only two used in 
base machine). It has 8K BASIC, 4K RAM, and can 
be expanded to 32K RAM, dual mini-floppies and 
a printer. 

C2-4P MF: $1533! It s a big personal 

computing mini-floppy system at a special package 

price. Contains the famous C2-4P microcomputer 

with 20K static RAM, 5" mini-floppy unit for instant 

program and data loading, RS-232 circuitry (for optional modem 

and printer), 'and diskettes featuring exciting games, personal, 

business and education applications. 



C2-oP DFl $2599! A full business system avail- 
able at a personal computer price! The system includes the 
powerful C2-8P microcomputer (32K RAM expandable to 
48K), dual 8" floppy unit (stores 8-times as much information 
as a mini-floppy), and 3 disks of personal, educational and 
small business applications software. Has all the capa- 
bilities of a personal system including graphics plus 
the ability to perform Accounting, Information Manage- 
ment, and Word Processing tasks for small business. 



Lr^'oPl $#99! The personal class computer that 
can be expanded to a full business system. Has all the 

features of the C2-4P plus an 
8 slot BUS (3-times greater 
expansion ability than the 
C2-4P). Can be expanded to 48K 
RAM, dual floppies, hard disk, 
printer and business software. 



I'm interested in OS! Computers. Send me information on: 

D Personal Computers D Small Business Computers 

□ Educational Systems D Industrial Development Systems 



Name 



Address 
City 



Stale . 
Phone 



-Zip_ 



CnmPUTERSHDP 

Boston Union N H Cambridge 

. 590 Comm. Ave. Rte 16fl 288 Norfolk St, 

(across from B.U.) 603-473-2323 (nearM.l.T.) 

. 247-0700 661-2670 




Presents 
Software and Hardware for your APPLE 



SALES FORECAST provides the best forecast using the four 
most popular forecasting techniques: linear regression, log 
trend, power curve trend, and exponential snnoothing. Neil D. 
Lipson's progrann uses artificial intelligence to deternnine the 
best fit and displays all results for nnanual intervention. $9.95 

CURVE FIT accepts any number of data points, ttistributed in 
any fassion, and fits a curve to the set of points using log 
curve fit, exponential curve fit, least squares, or a power curve 
fit. It will compute the best fit or employ a specific type of fit, 
and display a graph of the result. By Dave Garson. $9.95 

PERPETUAL CALENDAR may be used with or without a 
printer. Apart from the usual calendar functions, it computes 
the number of days between any two dates and displays suc- 
cessive months in response to a single keystroke. Written by 
Ed Hanley. $9.95 

STARWARS is Bob Bishop's version of the original and best 
game of intergallactic combat. You fire on the invader after 
aligning his fighter in your crosshairs. This is a high resolution 
game, in full color, that uses the paddles. $9.95 

ROCKET PILOT is an exciting game that simulates blasting off 
in a rocket ship. The rocket actually accelerates you up and 
over a mountain; but if you are not careful, you will run out of 
sky. Bob Bishop's program changes the contour of the land 
every time you play the game. $9.95 

SPACE MAZE puts you in control of a rocket ship that you 
must steer out of a maze using paddles or a joystick. It is a real 
challenge, designed by Bob Bishop using high resolution 
graphics and full color. $9.95 

MISSILE ANTI-MISSILE displays a target on the screen and a 
three dimensional map of the United States. A hostile sub- 
marine appears and launches a pre-emptive nuclear attack 
controlled by paddle 1. As soon as the hostile missile is fired, 
the U.S. launches its anti-missile controlled by paddle 0. Dave 
Moteles' program offers high resolution and many levels of 
play. $9.95 

MORSE CODE helps you learn telegraphy by entering letters, 
words or sentences, in English, which are plotted on the 
screen using dots and dashes. Ed Hanley's program also 
generates sounds to match the screen display, at several 
transmission speed levels. S9.95 

POLAR COORDINATE PLOT is a high resolution graphics 
routine that displays five classic polar plots and also permits 
the operator to enter his own equation. Dave Moteles' program 
will plot the equation on a scaled grid and then flash a table of 
data points required to construct a similar plot on paper. $9.95 

UTILITY PACK 1 combines four versatile programs by Vince 
Corsetti, for any memory configuration. 

POSTAGE AND HANDLING 

Please add $1.00 for the first item 
and $.50 for eacli additional item. 

• Programs accepted for publication 

• Highest royalty paid 



• Integer to Applesoft conversion: Encounter only those 
syntax errors unique to Applesoft after using this program 
to convert any Integer BASIC source. 

• Disk Append: Merge any two Integer BASIC sources into a 
single program on disk. 

• Integer BASIC copy: Replicate an Integer BASIC program 
from one disk to another, as often as required, with a 
single keystroke. 

• Applesoft Update: Modify Applesoft on the disk to elimin- 
ate the heading always produced when it is first run. 

• Binary Copy: Automatically determines the length and 
starting address of a program while copying its binary file 
from one disk to another in response to a smgle key- 
stroke. S9.95 

BLOCKADE lets two players compete by building walls to 
obstruct each other. An exciting game written in Integer 
BASIC by Vince Corsetti. $9.95 

TABLE GENERATOR forms shape tables with ease from direc- 
tional vectors and adds additional information such as star- 
ting address, length and position of each shape. Murray Sum- 
mers' Applesoft program will save the shape table anywhere in 
usable memory. S9.95 

OTHELLO may be played by one or two players and is similar 
to chess in strategy. Once a piece has been played, its color 
may be reversed many times, and there are also sudden 
reverses of luck. You can win with a single move. Vince Corset- 
ti's program does all the work of keeping board details and 
flipping pieces. $9.95 

SINGLE DRIVE COPY is a special utility program, written by 
Vince Corsetti in Integer BASIC, that will copy a diskette using 
only one drive. It is supplied on tape and should be loaded onto 
a diskette. It automatically adjusts for APPLE memory size 
and should be used with DOS 3.2. $19.95 

SAUCER INVASION lets you defend the empire by shooting 
down a flying saucer. You control your position with the pad- 
dle v/hile firing your missile at the invader. Written by Bob 
Bishop. $9.95 

HARDWARE 

LIGHT PEN with seven supporting routines. The light meter 
takes intensity readings every fraction of a second from to 
588. The light graph generates a display of light intensity on 
the screen. The light pen connects points that have been 
drawn on the screen, in low or high resolution, and displays 
their coordinates. A special utility displays any number of 
points on the screen, for use in menu selection or games, and 
selects a point when the light pen touches it. The package in- 
cludes a light pen calculator and light pen TIC TAC TOE. Neil 
D. Lipson's programs use artificial intelligence and are not 
confused by outside light. The hi-res light pen, only, requires 
48K and ROM card. S34.95 

TO ORDER 

Send check or money order to: 

P.O. Box 273 

Plymouth Meeting, PA 19462 

PA residents add 6% sales tax. 



U.S. and foreign dealer and distributor inquiries invited 
All programs require 16K memory unless specified 



The MICRO Software Catalog: XIII 



Mike Rowe 

P.O. Box 6502 

Chelmsford, MA 01824 



Name; Text Processing System (Editor and Assembler) 

System: APPLE II 

Memory: 24K 

Language: Integer BASIC and Machine Language 

Hardware: APPLE II, 24K and Disk II 

Description: This disk based system allows you to 
create and edit Applesoft, Integer BASIC, assembly 
language, and APPLE DOS exec files. The text editor 
provides capabilities to create load, modify and save 
APPLE II disk operating system text files. Editing 
features include simple-to-use data entry, extensive 
character and string searches and replacement, block 
line movement, and simple single line macros. Text 
creation and modification is further simplified with 
such features as tabbing, specific search windows, file 
merging, and line deletion. The text editor supports 
systems equipped with a printer to create permanent 
listings of text files. 

The assembler is a complete, disk-based, two pass 
symbolic assembler. You can assemble up to ten disk 
based text files at any one time. The assembler will 
generate disk based binary files that can be executed 
via the APPLE DOS "BLOAD" or "BRUN" commands. 
Eight character symbols allow for meaningful variable 
and routine names. The assembler supports all 56 stan- 
dard 6502 opcodes and six additional pseudo-opcodes 
used to define constants, labels, program addresses, 
etc. Meaningful error messages are generated to help 
locate program mistakes. The assembler can generate 
both program and symbol table listings, with optional 
line printer output. 

Copies: 200 

Price: $55.00 plus $1.00 shipping and handling 

California residents add 6 per cent sales tax 
Includes: All programs on a diskette and a complete 
60-page user's manual. 

Author: Jeffrey Gold 

Available from: 
Software Concepts 
Box 1112 
Cupertino, CA 95014 



Name: hlousehold Finance Program 

System: APPLE II 

Memory 32K 

Languace: Integer BASIC and Machine Language 

Hardwaie: APPLE II, 32K, and Disk II 



Descript 
prehensi 
manage; 
the caps 
months 
With a s 
check tn 

Error cc 
of editit 
catagorii 
analyze 
ditures c 
month-to 
available 
how well 
thiy budc 
be retriev 

Other pi 
tax dedui 
(backup) 
ports sys 
user sele 
mode. Tl 
easy-to-u 

Copies: 20 

Price: $3{.95 plus $1.00 postage and handling 

Calif Drnia residents must add 6 per cent sales tax 
Includes: All software supplied on a program diskette 
with a complete 32-page user's manual. 

Author: J(»ffrey Gold 

Available from: 
Softwaie Concepts 
Box 1 1 ■ 2 
Cupertiio, CA 95014 



ion: The household finance program is a com- 
ve household record maintenance and budget 
nent program. This disk based system provides 
bility to maintain 175 records a month for 12 
that's over 2000 records on a single diskette), 
mple to use data entry mode, a user can enter 
msactions, deposits, and cash expenditures. 

rrecting is a simple matter with a complete set 
ig features. Twelve user definable budget 
!S are available to allow a family to plan and 
spending patterns. Check and cash expen- 
an be assigned to any budget category. Both 
■date and year-to-date budget summaries are 
, Additionally, the program will provide data on 
the family is keeping to its established mon- 
lets. Previously entered financial records can 
ed via a comprehensive data listing mode. 

ogram features include checkbook balancing, 
;tible classification, and single disk drive copy 
'0 protect against data loss. The program sup- 
tems equipped with a printer and can provide 
;ted permanent listing via a unique page print 
is software package is the most complete, 
se home financial program available today. 



October, 1979 



MICRO — The 6502 Jounal 



17:49 



Name: Belais' Master Index to Computer Programs in 
BASIC 

System: All 

Memory: N/A 

Language: BASIC (a few programs require machine 

ianguage routines) 
Hardware: N/A 

Description: A directory of computer programs written 
in BASIC. The programs are ones that have appeared in 
ten major home computer magazines. They cover both 
business and personal applications. All major computer 
systems are included. Many of the programs are written 
specifically to take advantage of the capabilities of 
such 6502-based computers as the PET and the APPLE 
II. The reviews provide detailed information about what 
each program does, and what hardware and software it 
needs. Program listings are not provided, but informa- 
tion is given on where to get them. 

Price: $9.95 plus $1.00 shipping 

California residents must include 6 per cent sales 
tax. 

Includes: Book 
Order info: VISA/Master Charge accepted (give account 

number, expiration date, and signature). 

Author: Paul Belais 
Available from: 

Falcon Publishing 

Dept. Y 

P.O. Box 688 

Ben Lomond, CA 95005 

Name: Mailing List Program 

Memory: 48K with DOS and Applesoft ROM 

Language: Applesoft II 

Hardware: APPLE II, disk drive, printer 

Description: The mailing list program is a disk based, 
menu driven program written in Applesoft II. In order to 
use the program, a 48K system with Applesoft II on firm- 
ware along with one disk drive and DOS 3.2 is required. 
If your system does not have Applesoft II on firmware, 
the mailing list program can still be used but the 
number of entries will be greatly reduced. 

The program is able to maintain a complete mailing 
list. The mailing list data base can be changed, sorted, 
searched, added, deleted and reformatted. There are 
five types of sort and five types of search. Labels can be 
printed out on a 40, 80 or 132 character printer and also 
viewed on the screen for rapid editing. The program ac- 
comodates zip codes with seven digits for use outside 
the U.S.A. 

There is a routine for lining up the labels and for set- 
ting the spaces between the labels. Provision has also 
been made to make a backup copy of the data with a 
single disk drive. The mailing list program makes 
generation and maintenance of a mailing list very quick 
and simple. 

Price: $34.95 for diskette plus $1.25 shipping 
Includes; User manual and documentation. 

Author: Gary E. Naffer 

Available from: 
Software Technology for Computers 
P.O. Box 428 
Belmont, MA 02178 



Name Black Box 
System. APPLE II 
Memory: 16K 
Language: Integer BASIC 
Hardv\are: Cassette 

Descr ption: The program Black Box is based on the 
Parkei Brother's game of the same name. The object of 
the game is to guess the positions of marbles that are 
hidden on an eight by eight board. To help you find the 
marbJiis, rays are sent into the box. These rays can hit a 
marblo, be deflected by a marble, be absorbed into the 
box, o' any combination of these! There are full instruc- 
tions inside the program, and a sample game to get you 
going. Test your reasoning power against the mystical 
Black Box! 

Price: $8.00 

Includes: Verified cassette, postage and handling 

Autho" Robin Hodgson 

Available from: 
The AppleCorp 
103 Horizon 14 
723 14th St. N.W. 
Cal(|ary, Alberta 
Canada 
T2N 2A4 



Name: APPLE— DOC 

System: APPLE II 

Memory: 3.5 to 5.8K depending on options. 

Langu ige: Applesoft II 

Descr ption: Set of three programs— VARDOC, 
LINEDDC, and REPLACE. 

VARC'OC produces a list of every variable used in your 
program and all the lines each is used on. Screen and/or 
printer output can include optional descriptors of each 
variable. 

LINEDOC produces a list of every line called by a 
GOTO, GOSUB, etc, and all the lines each is called 
from. Vou are even alerted to calls to lines no longer in 
the listing. Optional descriptors are for each line 
number. 

REPL^CE allows you to easily rename any or all oc- 
curances of any variable in your program. Even change 
variabiB types! Can also be used to replace constants 
or referenced line numbers within the listing. The Literal 
Mode illows you to replace any set of characters or 
BASIC statements with any other set. This program is 
especiilly useful when appending subroutines with 
conflicting variable use. 

Price: !i9.95 for cassette, $13.95 for diskette. 

California residents must add 6 per cent sales 

tax. 
Includfs: Three programs plus documentation. 

Author Roger Wagner 

Availatile from: 

Local Computer Stores or 

Southwestern Data Systems 

P.O. Box 582 

Santse, CA 92071 

(714) 562-3670, SASE for free information 



17:50 



MICRO — The 6502 Journal 



October, 1979 



Name; Roger's Easel 
System: Apple II 

Memory: 16K for Integer and Applesoft ROM, 20K for Ap- 
plesoft RAM 

Description: Set of three programs: Roger's Easel, Lo- 
Res Link-Integer, and Lo-Res Link-Applesoft. A paddle 
oriented sketching program using the color graphics of 
the APPLE II. The unique features of this set include the 
ability to store and retrieve user created pictures from 
tape or disk, ability to erase with a single keystroke, 
resuming original color when done, and immediate ac- 
cess to a detailed help list while in the program. The 
most outstanding feature is the option of permanently 
linking up to 41 pictures to any Integer or Applesoft pro- 
gram for instant recall at any time. Besides being just 
plain fun, applications range from putting more creative 
screen images in your game programs to educational 
programs for younger children involving shape or color 
recognition. 

Price: $9.95 on cassette, $13.95 on diskette 

California residents add 6 per cent sales tax 
Includes: Three program set with ten-page manual. 

Author: Roger Wagner 

Available from: 

Local APPLE dealers or: 
Southwestern Data Systems 
P.O. Box 582-MC 
Santee, CA 92071 
(714) 562-3670 

Name: Programmer's Utility Pack 

System: APPLE II 

Memory: 4K to 6K (for the prog, itself) depending on 

the program used. 
Language: Integer and Applesoft 
Hardware: APPLE II with cassette or disk drive 

Description: Set of 11 programs. Appends, STR$() 
and VAL() are on printed documentation with the 
tape version. Programs include: Renumber — Integer 
& Applesoft, Append — Integer and Applesoft, Line 
Find — Integer and Applesoft, Address/HEX 
Converter, Screen Find, Memory Move, and the 
STRSO and VAL() function simulations for Integer. 

By using the various programs one can renumber 
Integer and Applesoft programs with all GOTO's, etc, 
being renumbered and the user alerted to unusual 
situations in the program. These include reference 
line numbers not in the program, lines referenced by 
a variable or expression, and a number of others. 

Line Find allows the user to locate the actual 
address range of a line in memory so as to be able to 
insert CLR, HIMEM:, etc. It can also be used on 
occasion to recover programs garbaged by dropped 
bits. Address/HEX Converter converts between the 
HEX, Integer, and Applesoft address formats. It also 
provides the two byte breakdown of numbers greater 
than 256 for use in pointers, etc. 

Screen Find is used for printing directly on the 
screen by POKEIng appropriate values into the proper 
locations in memory. Screen Find gives these values 
and locations when the characters desired and the 
horizontal and vertical screen positions are input. 
Memory Move allows one to move blocks of memory 



up or down any number of bytes from Integer or 
Applesoft. The Monitor has a routine similar to this, 
but it cannot be used to move blocks up a small 
distance and it is not possible to use it directly from 
Applesoft. 

STR$() simulates the function of this name in 
Applesoft for use in Integer programs. STR$() in 
Applesoft converts a number to a string. VAL() is 
similar but converts strings to numbers. 

Copies: Just Released 

Price: $16.95. Calif, residents add 6 per cent sales 
tax. 

Includes: Two cassettes or one diskette plus 
doc jmentation. 

Author: Roger Wagner 

Availabli! from: 

Local Apple dealers, or: 
South western Data Systems 
P.O. Eox 582-MC 
Sante.), CA 92071 
(714) f. 62-3670 

Name: Softtouch Utility Pac II 

System: APPLE II 

Memory: 24K with DOS 

Language: Integer and Applesoft BASIC 

Hard war 3: Disk drive 

Descript on: Set of nine programs on disk. Programs 
include checkbook update to DOS, update electronic 
index fil3, auto-write instructions, find hidden control 
characters, slow/stop list, disk space, listing headers 
and exet reader. A complete listing is provided for all 
program:! and programming. 

Checkbook update rewrites your original checkbook 
program for use with the disk drive. Routines have 
been adiJed to change accounts or list bank names 
with ace sunt numbers, etc. Index update rewrites Bob 
Bishop':; electronic index file for complete 
automation. A printing routine has been added for 
hard copy. 

Auto write appends subroutines to existing 
programs, converts integer BASIC listings to 
Applesoft or vice versa. Auto write documentation 
gives detailed instructions for using the program to 
patch in lines in any part of a program or delete 
illegal lines such as 65535, etc. Find hidden control 
characte' displays any control character burried in a 
catalog name or any listing for both integer or 
Applesoft BASIC. Disk space is written in Applesoft 
and gives sectors and bytes left on a diskette. No 
text files are created by the program and operating 
time is three seconds. Slow/stop list may be loaded 
in and used continuously after switching disks or 
languages. Exec reader will read text files for all of 
the above with the exception of index file. 

Price: $19.95 

Includes: One diskette plus documentation. 

Author: [)r. Nick Romano 

Available from: 
Softtouch 
P.O. B3X 511 
Leominster, MA 01453 



October, 1979 



MICRO — The 6502 Journal 



17:51 



kTM 



A Warning: 

The MflCROTcfl' 

is for Professionol 
Programmers — and Very 
Serious Amateurs — Only 

Now: a machine language pro- 
gramming powerhouse for the 
knowledgeable programmer who 
wants to extend the PET's capa- 
bilities to the maximum. The 
MacroTeA, the Relocating Macro 
Text Editor Assembler from Skyles 
Electric Works. 

The Skyles MacroTeA is a super 
powerful text editor. 26 powerful 
editing commands. String search and 
replace capability. Manuscript feature 
for letters and other text. Text loading 
and storage on tape or discs. Supports 
tape drives, discs, CRT, printers and 
keyboard. 

The Skyles MacroTeA is a relocating 
machine language assembler with true 
macro capabilities. A single name 
identifies a whole body of lines. You 
write in big chunks, examine, modify 
and assemble the complete program. 
And, when loading, the MacroTeA goes 
where you want it to go. Macro and 
conditional assembly support. Auto- 
matic line numbering. Labels up to 10 
characters long. 

The Skyles MacroTeA is an enhance 
Monitor. 11 powerful commands to 
ease you past the rough spots of 
program debugging. 

The Skyles MacroTeA is a warm 
start button. Over 1700 bytes of 
protected RAM memory for your object 
code. 

There's no tape loading and no 
occupying of valuable RAM memory 
space: The Skyles MacroTeA puts 10K 
bytes of executable machine language 
code in ROM (from 9800 to BFFF — 
directly below the BASIC interpreter). 
2K bytes of RAM (9000 to 97FF). 

Like all Skyles Products for the PET, it's practically plug in 
and go. No tools are needed. And, faster than loading an 
equivalent size assembler/editor from tape, the MacroTeA is 
installed permanently 

The Skyles MacroTeA: 13 chips on a single PCB. Operates 

interfaced with the PET's parallel address and data bus or with 

the Skyles Memory Connector (When ordering, indicate if the 

MacroTeA will interface with a Skyles Memory Expansion 

System. You can save $20.) Specifications and engineering are 

up to the proven Skyles quality standards. Fully warranted for 90 

days. And, as with all Skyles products, fully and intelligently 

documented. 

VISA, Mastercharge orders call (800) 227-8398 (Except Calif.) 
Califomia orders please call (415) 494-1210. 

Skyles Electric Works 

10301 Stonydale Drive, Cupertino, CA 95014, (408) 735-7891 



Hypocycloids 



E.D. Morris 

3200 Washington Street 

Midland, Ml 48640 



A modification to John Sherburne's original program 
plots hypocycloids quite a bit faster, on the OSI, by 
reducing the number of revolutions required. The 
technique may be used on any micro. 



I had just added the e;;tra 2K of 
memory to my Ohio Scientifi ; 440 video 
board to implement the graphics option, 
and was wondering what 1o do with 
those 16,384 dots (128xi;!8) staring 
out from my monitor. I happened to picl< 
up the March 79 issue of MICflO and was 
intrigued by John Sherburne' 3 article on 



plotting hypocycloids. A hypocycloid, if 
you don't remember, is what you get 
when one circle rolls inside another as in 
the "Spirograph" toy. I immediately ac- 
cepted the challenge that if it can be 
done on a PET, I could do it better on my 
micro. 





The original hypocycloid program suf- 
fered greatly from lacl< of speed since 
each point was calculated using four 
trigonometric functions. Approximately 
300 points per revolution were required. 
Even then, some gaps appeared in the 
resulting pattern. I was able to reduce 
the number of points calculated per 
revolution to 30 by drawing straight line 
segments between calculated points. 
This makes the resulting curves not 
quite as smooth, but very acceptable as 
the accompanying photos illustrate. The 
number appearing in the lower left cor- 



ner indicates the number of resolutions 
required to complete the figure. 

Below is the subprogram I used to fill 
in the space between calculated points 
(X1,Y1) and (X2,Y2). A different pro- 
cedure is used depending whether the 
slope of the plotted line is neater the X 
axis or Y axis. Lines 1060-1065 and 
1160-1165 store the bit in menory and 
are specific to my graphics Doard. I 
would be happy to provide a copy of the 
full program to anyone who is using the 
OIS 440 board with graphics. 



1000 IF X1=X2 THEN 1100 

1010 A:(Y2-Y1 )/(X2-Xl ) 

1015 IF ABSCA)>1 THEN 1100 

1020 B=Yl-A»Xl+0.5 

1030 FOR X3=X2 TO XI STEP 3GN(X1-X2) 

1040 Y3 = INT(B-^A»X3) 

1060 M=54272+16»Y3+INT(X3/3) 

1065 P0KEM,PEEK(M)0R3(X3AND7) 

1070 NEXTX3:RETURN 

1100 IF Y1=Y2 THEN RETURN 

1110 A=(X2-X1 )/(Y2-Y1) 

1120 B=Xl-A»Yl+0.5 

1130 FOR Y3=Y2 TO Y1 STEP SGN(Y1-Y2) 

1140 X3 = INT(B-^A*Y3) 

1160 M = 54272 + 16»Y3-^INT(X3/3) 

1165 P0KEM,PEEK(M)0RS(X3AND7) 

1170 NEXTY3 

1130 RETURN 




J 



To Order PROGRflMMCR'S ToOlKiT or MflCRoTcfl — 

Custom designed to plug into your PET. So, when ordering, please indie jte if your 
Toolkit: 



...will be used with theSkyles Memory Expansion System, or 
...will be used with the ExpandaPet, or Expandmem 

...will be used with the PET 2001-8 alone 

fWe furnish connectors to the memory expansion bus and to the second cassette Interface. 

...will be used with the PET 2001-16, -32 (chip only) 

...will be used with Skyles MacroTeA 



$80.00* 
$80.00* 
$80.00* 

$50.00* 
$50.00* 



Is Progromming Fun? 

Hove More Fun, 
Moke Feuuer 6rrors, 
Complete Programs Much 
Foster... uiith the 

0flSICPROGRflMM€R'S 

Toolkit™ 

Now you can modify, polish, simplify, 
add new features to your PET pro- 
grams far more quickly while reducing 
the potential for error. That all adds up 
to more fun . . . and the BASIC 
Programmer's Tool Kit. 

The magic of the ToolKit: 2KB of 
ROM firmware on a single chip with a 
collection of machine language pro- 
grams available to you from the time 
you turn on your PET to the time you 
shut if off. No tapes to load or to 
interfere with any running programs. 
And the Programmer's ToolKit installs 
in minutes, without tools. 

Here are the 1 commands that can 
be yours instantly and automatically 
. . . guaranteed to make your BASIC 
programming a pleasure: 



AUTO 


RENUMBER 


DELETE 


HELP 


TRACE 


STEP 


OFF 


APPEND 


DUMP 


FIND 







IS 



Every one a powerful command to 
insure more effective programming. 
Like the HELP command that shows 
the line on which the error occurs 
. . . and the erroneous portion 
indicated in reverse video: 



HELP 
500 J = SQR(A*B/W) 



... Or the TRACE command that 
lets you see the sequence in which 
your program is being executed in a 
window in the upper corner of your 
CRT: 




The Programmer's ToolKit is a 

product or Harry Saal and his 
associates at Palo Alto ICs. 

So, if you really want to be into 
BASIC programming — and you want 
to have fun while you're doing it, order 
your BASIC Programmer's Toolkit 
now. We guarantee you'll be de- 
lighted with it. 



Your MacroTeA. Custom designed for your PET. Sospecify your PET model when orde ing. $395.00* 

(Important Savings: If it's to be used with a Skyles Memory Expansion System, the Mi croTeA can 

plug directly into the SKyles connector. So you save $20. The Skyles MacroTeA is c nly $375.00 

when interfaced with the Skyles Memory Expansion System.) 

Send your check or money order to Skyles Electric Wcrks. VISA, Mastercharge orders may call (800) 

227-8398. (California residents: please phone (415) 494-12 0.) 

Ten Day Unconditional Money-Back Guarantee on all products s >ld by Skyles Electric Works, except chip only. 

California residents: please add 6-6V^% California sales tax. 

Skyles Electric Works 10301 Stonydale Drive, C upertino, CA 95014, (408) 735-7891 





CONNECTICUT microCOMPUTER , Inc. 

150 POCONO ROAD - BROOKFIELD, CONNECTICUT 06804 
TEL: (203) 775-9659 TWX; 770-456-0052 



mm 

SYMTCMS 



PETMOD 



RS-232 
MOD 



RS-232 
INTERFACE MODULE 




GPlB(IEEE-488) 
INTERFACE MODULE 








TRS-80 INTERFACE 



MANUAL AND 
DISPLAY MODULE 



ANAMANl 



r-inr-ini-|i 



ANALOG 

MANIFOLD 

MODULE 



C^ 

SENSORS 

• TEMPERATURE 

• VELOCITY 

• PRESSURE 

• db 

• pH 

• ACCELERATION 

• HUMIDITY 
•LIGHT LEVEL 

• FLUID LEVEL 

• ETC. . . 



DAM SYSTEMS by ( mC 
A coiplele s>isle> of aodules to lei uou coBPuler listen 
to the real worldt 



DAM SYSTEMS PRICE LIST 



DAM SYS I EMS coiiif-^or.en tsi 



AIMlAl - Analos Input. Module 

14 3-bil aialoa inmU - lOO ■icrosecaid coiwpsion liw - 3 
sUle outpuL - reauirK Qn« 8-bit CQWul«r oulwt rart for 
coilriil and we 8-bil cuvulcr inml nrl for dsli. 

F'QUIl - Pouter Module 
Supplies mer for one AIH16 lodule. 

ICON - Input Connector 

For ctnnHlin^ jnsloa innils U> Uw AIKli - 20 Pin card edse 
comecUr - solder ewlels. 

OCON - Output Connector 

Far Mrneclina He AIMU lo a comter - 20 pin card ed* 
nnnficUr - solder ewlels. 

MANMOni - Manifold Module 

Use in Place of ICON. Scrn teriinal lurrier strips for 
omnectin^ Jovslidtsr polenlioftetersi vollase sources^ etc> 
Eliiinatcs Uw need for soldering. Plus inlo Uw AIHU. 

ANAMANl - Analoa Manifold Module 
Use in place of ICON. Cmnecls MM STSTDIS SOfitKS lo U» AINli 
uithoul soldering - sensor cables Just pIu^ in. Plu^s into Uie 
MIU6 or U« HHMDl. 



« 179. 



SENSORS 

Sensors for teverdturef pressure! 
Hlioni etc. 



fiowT luiiditvf leMelr pMf 



COMPUTER interfaces; 

For Us pel. Of TRS-90> etc. Use in place of OCW. Elinnates 
U> need for soldering or special construction. 

PETMOD - PET Inter-fBce Module 
Gives tin IEEE porlst one user port and one Ml SVSTEHS 
interface port. Saves uear and tear oi U« PET's printed 
circuit bovd. Also called U» PETSAW. 

KIMMOn - KIM Interface Module 
Gives one application connector port and one OAfl SfSTEMS 
interface pert. 



TBA 



TEiA 



TBA 



»49.93 



*39 .91:. 



CABLt "A" - Interconnect Ci-ubXei:; 
Connecl i coemter interface to AIHUi WMDISli XPMKl. etc. 

CABLE A24 - In ter connec: t Cable 
24 inc^ cable uilh interface connector on one end and an OCON 
eouival n I on the other. 

MANDI;;1 - Manual an.-j Diiir-law Module 
Connecl Iwtueen Uw A1M1& and the cuenter interface. Ulous 
ianual r coeputer control of the AIHU. Display channel 
nd data. 



GPI6 I OD - GPIB ( IEEE -488 ) Interface 
Allows be DM SrSTEAS HOOJLES to be used with the GPIB bus 
instead of a coeputer's other 1/0 ports. 

RS232 MOD - RS:i32 Interface Module 
Allows tie OM 3YSTEHS hODULES to be used itith an RS-232 wt 
or leri rial. 



TBA 



XPANDF 1 - Expander Module 

Allows I > lo 126 3-bil analog inputs (3 AIM16 Hodules) 
conned J lo one s>fite*. 



DAM < YSTEMS sets 



TBA 



TBA 



lo be 



AIM16; Starter Set 1 SiaV.OO 

Include one Aimil> one POIU we lOM and one OCON. 

AIM16] Starter Set 2 «239.00 

Include one AimUi one POUi one HmSA and one OCSN. 

PETSETla *29S.OO 

iMliKta^ one PETKIDi one CAKE «24> one AIIU6I1 one PIMl and 
one MM Dl. 

KIMSEl :l3 t'v'85 . 00 

Includes one KUWDf one CABLE A24> one AlhUli one POUl and 
oneNM 101. 



SYM-1 6532 Programmable Timer 



The 6532 interval timer is useful as a backup timekoeper 
or as a loop controller. It can be accessed in two ways, 
independent of the interrupt system, and employed to 
meet a variety of realtime program requirements. 



Robert A. Peck 
1276 Riesling Terrace 
Sunnyvale, CA 94087 



In addition to the programmable ports 
and interval timers located In the 6522s, 
the SYM-1 has an interval timer in the 
6532. The 6532-style device is also used 
on the KIM-1, and so knowing how to use 
the SYM timer properly will help in 
understanding KIM programs and 
enable the SYM programmer td adapt 
KIM programs for use on his SYM more 
easily. 

The 6532 timer does not have its IRQ 
line connected to the IRQ input of the 
6502. Therefore, lacking direct access to 
the interrupt structure, we are unable to 
get as precise a level of timing as with 
the onboard 6522s. However, if an extra 
timer or loop controller is required, the 
6532 may prove to be useful. 

Before using the timer in the 6532, one 
must first clear the interrupt flags. Since 
all of the features we intend to use are 
part of the write-protected memory, we 
must first of all allow access to this 
area. This is accomplished by: 



20 86 8B 



JSR ACCESS 



Then, to clear the interrupt flag {PA7 
flag), we will read the interrupt flag 
register. This may be accomplished by 
reading any one of four locations: A405, 
A407, A41DorA41F, typically by execut- 
ing the instruction: 



AD 05 A4 



LDA INTREG 



J 



After this instruction is executed, the 
interrupt flag register will contain "80". 
This register will be cleared to "00" 
when we write a value Into the timer 
register. We may then go back occa- 
sionally during program execution, test 
to see if the flag register is still zero, and 
branch if it is not zero. 

As another alternative, we can do a 
BIT test on the flag location, checking 
only the timer flag for the branch condi- 
tion. This method has been used in the 
sample program. If the BIT test is used, 
it is not necessry to read the interrupt 
register in order to clear the PA7 flag 
because this flag will not be tested. The 
initial read instruction then becomes 
redundant. 



At this point, we must dec ide how 
many clock cycles are to elapje before 
the timer flag becomes set. The i we will 
write the selected value into the counter. 

There ar-e four different p sints at 
which to enter data into the counter, 
A41C, A41D, A41E and A41F. T lese are 
indicated in the manual as IT 8T, 64T 
and 1024T. These multiples m san that 
any data which is entered nto the 
counter will begin at that particular 
count and decrement at the ra e of the 
clock frequency (IT), or at on j decre- 
ment for each eight clock cycles (8T), 
one decrement for each 64 cloc k cycles 
(64T) or one decrement for essh 1024 
clock cycles (1024T). 

There is only one timer regi: ter, but 
the four addresses mentioned a )ove are 
the means by which the freque icy pre- 
divider is set. For example, if '*e write 
"01" into location A41E, the timur flag is 
reset and, 64 clock cycles later, t ie timer 
flag is set again. If we write " )1" into 
location A41F, instead, then tl e timer 
flag will not be reset until 10; 4 clock 
cycles have elapsed. 

Just as an example, let's say we 
wanted 800 clock cycles to elapse 
before the timer flag is set. W« will be 
reading the flag register period cally to 
see if it is non-zero, determine whether 
the flag gets set, and branch on he non- 
zero condition. Writing decimal 00 (hex 
64) into location A41D sets lie pre- 
divider; to 8 then, 8 x 100 = 8 X) ticks 
later, the timer reaches zero and the flag 
is set. 

While the counter Is independently 
decrementing, we can determine the cur- 
rent timer contents at any t me by 
reading one of these four lo lations: 
A404, A406, A41C, A41E. There ire four 
readable locations due to "don t care" 
addressing modes or incompi ste ad- 
dress decoding. 

One might be tempted to lool at the 
timer contents, occasionally, and 
branch when the count reaches zero. 
This does not offer a good chaice for 
success as the following exam )le will 
show. 



Let's say we've written "OA" (decimal 
10) into location A41D (8T) so that 80 
cycles later the timer will count down to 
zero. Suppose we do the following dur- 
ing the counting period: 

(A) Increment a memory location 

(B) Test timer contents 

(C) Branch back if non-zero 



If the sequence of operations takes 
seven machine cycles, then after 77 
cycles the timer will still be at "01" and 
after 77 -i- 7 = 84 cycles the timer will 
contain a count of zero since more than 
80 cycles have elapsed, right? Wrong! 
Unfortunately, it will contain "FC" in- 
stead! The limitation of this counter is 
that, as soon as zero is reached and the 
flag is set, the counter continues to 
decrement, but it no longer matters 
which counter multiple was being used 
because as the counter immediately 
begins to free-run decrement at the IT 
rate. 

To overcome this limitation, since we 
do not use the IRQ and since we only 
sample occasionally, we will generally 
read the interrupt register, testing for a 
non-zero figure, rather than reading the 
timer and looking for zero contents as 
shown above. 

Now we come to an example program 
which ties everything together and 
demonstrates the use of this timer. 
Location 20D may be set for any desired 
timer value. Location 20F may be set to 
1C, ID, 12E, or IF depending upon 
whether you want to operate the timer 
with a predivide of IT, 8T, 64T, or 1024T. 
You will notice that the loop of instruc- 
tions between locations 211 and 224 
takes a total of 28 machine cycles to ex- 
ecute. 



Begin program execution at location 
200. The display will light, upon comple- 
tion indicating how many times the pro- 
gram was able to traverse the loop 
before the timer flag became set. 



October, 1979 



MICRO — The €502 Jour lal 



17:55 



Letters 



Having trouble running mnemonically- 
entered programs on your AIM-65? This 
might be one source of the problem. 

According to the AIM-65 User's Guide, 
indirect indexed addressing mode may 
be entered by using either "(HH,Y" or 
"(HH)Y" where "HH" is a hexadecimal 
byte. The AIM-65 Summary Card lists the 
alternatives "(HH,Y" or "(HH.Y)". 

However, only the format "(HH)Y" will 
assemble correctly. 

The formats {HH,Y and {HH,iO will be 
assembled incorrectly as indexed in- 
direct instructions, "{HH,X)". 

Don Stein 

6012 Chats worth Lane 

Bethesda, MD 20014 



DON LANCASTER'S 

INCREDIBLE SECRET 
MONEY MACHINE 

A cookbook for creating 

your own computer or 

tech venture. 




SYNERGETICS box 1077 m 

THATCHER, AZ 85552 

( ) Send ISMIVI's ( ) Check ( ) Visa 

( ) Send FREE Lancaster Booklist 











• P OGRAMMABLE TIMER DEMONSTRATION PROGRAM 

41 










• B' ROBERT 


A. PEOK 












• M( DIFIED BY MICRO 


STAFF 


02t1 








AOOl SS 


• 


$8B86 




02t1 








OUTI SP 


• 


$8901 




02U1 








OUTIYT 


• 


$82FA 




02K1 








SCAhD 


• 


$8906 




0200 










ORG 


$0200 




0200 


A9 


00 






LDAIM 


$00 


STORE ZERO IN 


0202 


85 


AO 






STA 


$0OA0 


AREA RESERVJ!D FOR TOTAL 


0204 


85 


Al 






STA 


$00A1 




0206 


20 


86 


8B 




JSR 


ACCESS 


UNPROTECT SYSTEM RAM 


0209 


AD 


IF a4 




LDA 


$A41F 


CLEAR PA7 FLAG, OPTIONAL HERE 


020C 


A9 


FF 






LDAIM 


$FF 


LOAD TIMER PRESET NUMBER 


Q20E 


8D 


ID 


A4 




STA 


$A41D 


ESTABLISH 8 AS PRE-DIVIDE 


0211 


F8 






TMIS 


SED 




TIME = 255 • 8T = 2040 CYCLES 


0212 


A5 


AO 






LDA 


$00A0 


SET DECIMAL MODE 


0214 


69 


01 






ADOIM 


$01 


LOAD AO AND ADD ONE 


0216 


85 


AO 






STA 


$00A0 


PUT IT BACK 


0218 


A5 


Al 






LDA 


$00A1 


IF THERE'S A CARRY 


021A 


69 


00 






ADOIM 


$00 


ADD IT IN 


021C 


85 


Al 






STA 


$00 A 1 


AND RESTORE 


021E 


D8 








OLD 




CLEAR DECIMAL MODE 


021F 


20 


05 


A4 




BIT 


$A405 


TEST TIMER FLAG 


0222 


30 


03 






BMl 


TMOUT 


BRANCH IF MINUS FLAG IS SET 


0224 


40 


11 


02 




JMP 


TMIN 


JUMP BACK AND DO IT AGAIN 


0227 


A9 


20 




TMOU' 


LDAIM 


$20 


ASCII BLANK 


0229 


20 


01 


89 




JSR 


OUTDSP 


SEND IT TO DISBUF 


022C 


A5 


Al 






LDA 


$00A1 


GET CONTENTS OF Al 


022E 


20 


FA 


82 




JSR 


OUTBYT 


SEND IT TO DISBUF 


0231 


A5 


AO 






LDA 


$00A0 


NOW GET AO 


0233 


20 


FA 


82 




JSR 


OUTBYT 




0236 


A9 


20 






LDAIM 


$20 


ASCII BLANK 


0238 


20 


01 


89 




JSR 


OUTDSP 




023B 


20 


06 


89 


DSOAt 


JSR 


SCANB 


SCAN THE DISPLAY 


023E 


40 


3B 


02 




JMP 


DSCAN 


DO IT CONTINUOUSLY 


SYMBOL 


TABLE 2000 2' 2A 






ACCESS 


8B86 


DSOAI 


023B 


OUTBYT 82FA OUTDSP 8901 


SCAND 


8906 


TMIN 


0211 


TMOUT 0227 



While working on a lea ing rate 
calculation program In Kim BASIC I 
found the need for a list of variables 
available so that I could cros s out the 
ones 1 used in my program. I fc und such 
a list In MICRO 4:4 and decide i to write 



a program, in BASIC, to print it when 
needed. 

Henri Relher 
4236 Madison 
Montreal, QUEBEC 
CANADA H4B 2T9 



100 REM PROG TO SHOW 1 UMERICAL AND STRING VARIABLES AVAILABLE IN 



Name _ 



Address . 

CilY Slaie. 

Visa — - 



. ZiP- 



Exp / Signature. 



AS USED IN PET-APPLE-TRS80 AND OTHERS 
APRIL-MAY 78 PAGE 4:4 



110 HEM MICROSOFT BAS] : 

115 REM REF: M I C R D 

"120 FOR X = 65 TO 90 

125 PRINT 

130 PRINT CHRCX);" "; 

140 FOR Y = TO 9 

145 Y$ : CHR(X) + NUM( O + " " 

147 REM INSTEAD OF NUK;Y) YOU CAN USE STH$(Y) 

150 PRINT Y$; 

155 NEXT Y 

160 FOR Z = 65 TO 90 

170 PRINT CHR(X);CHR(Zi;" "; 

180 NEXT Z 

200 PRINT 

210 NEXT X 

220 END 



17:56 



MICRO — The 6502 Joi -nai 



October, 1979 



More LETTERS 



I have a SYM-1. While debugging a 
program that uses the timer in the 6532 1 
found out that the IRQ pin is not con- 
nected to the IRQ bus. Rather than 
spend a lot of time finding the neatest 
way to connect the 6532 IRQ pin to the 
IRQ bus, I simply ran a piece of wire 
wrap stock between the IRQ pin on the 
6532 to the nearby 6522. Now I can use 
the interrupt feature of the 6532. 1 do not 
know whether Synertek did this for a par- 
ticular reason but I have not had any pro- 
blems since making this little modifica- 
tion. Perhaps you are already aware of 
this. I just thought I would pass it along, 
for what it is worth. 

Keith Le Baron 
1260 S. Blackhawk 
Freeport, IL 61032 



There is a useful, but unadvertised, 
display subroutine in the AIM-65 
Monitor. It is labeled 0UTDD1, and can 
be called by a JSR instruction to hex ad- 
dress EF7B. 

The subroutine displays the ASCII 
character which is in the accumulator, 
at the relative position (0 - 19 decimal, or 
- 13 hexadecimal) indicated by the X 
register. It returns with A and X contents 
intact. 

Before calling the subroutine, be sure 
to ORA #80, or else the hardware cursor 
will be displayed. 

Don Stein 

6012 Cliatsworth Lane 

Bethesda, MD 20014 



[Editor's Note: Marvin De Jong 
demonstrated the use of this subroutine 
in an earlier issue of MICRO. Since, 
however, Don Stein independently 
"found" it and thinks that it is important 
enough to point out to other AIM users, 
we are printing his letter.] 

[Editor's Note: If you have some small 
bit (byte?) of information that you wish 
to pass on to fellow computerists, a 
short letter to MICRO is one simple way 
to "pass the word along".] 



) 



TEXTCAST 



Turn your PET into a WORD PROCESSOR 
comparable to large systems for a fraction 
of the cost! 

CREATE-REVIEW-EDIT FILES 
ON TAPES OR DISKS 

PRINT TEXT-LETTERS-FORMS- 
TABLES 

TEXTCAST FITS YOUR PET 
SYSTEM, OLD AND NEW ROMS 

CLEAR INSTRUCTIONS! 

Prices: Tape plus manual, $60. 

Diskette plus manual, $65. 

Manual separately, $20. 
Write: Cognitive Products 

P.O. Box 2592 

CHAPELHILL,N.C. 27514 

PET Trademark of Commodore Business Machines, Inc. 



DISK DRIVE WOES? PRINTER INTERACTION? 

MEMORY LOSS? ERRATIC OPERATION? 

DON'T BLAME THE SOFTWARE! 





ISO-1 '~y ISO-2 

Power Line Spikes, Surges & Hash could be the culprit! 
Floppies, printers, memory & processor often interact! 
Our unique ISOLATORS eliminate equipment interaction 
AND curb damaging Power Line Spikes, Surges and Hash. 
♦ISOLATOR USO-1A) 3 filter isolated 3-prong sockets, 
integrai Surga/Spike Suppression; 1875 W Maximum load, 

1 KW loadany socket $54.95 

♦ISOLATOR (ISO-2) 2 filter isolated 3-prong socket banks; 

(6 sockets total); integral Spike/Surge Suppression; 

1875 W Max load, 1 KW either bank $54.95 

•SUPER ISOLATOR <«SO-3), similar to ISO-1 A 

except double filtering & Suppression .... $79.95 
♦ISOLATOR (ISO'4), similar to ISO-1 A except 

unit has 6 individually filtered sockets .... $93.95 
♦ISOLATOR (ISO-5), similar to ISO-2 except 

unit has 3 socket banks, 9 sockets total . . . $76.95 
♦CIRCUIT BREAKER, any model (add-CB) Add $ 6.00 
♦CKT BRKR/SWITCH/PILOT any model 

(-CBS) Add $11.00 

M| PHONE ORDERS 1-617-655-1532 

IS7 Electronic Specialists, Inc. 



171 South Main Street. Natick. Mass. 01760 



Oeptmi 



October, 1979 



MICRO — The 6502 Journal 



17:57 



rnrri up to ^1/0 in merchandise 
rtftt! with the purchase of PET-CBM 
item!!! 



FREE 
MERCH. 



$ 995 $130 
$1295 $170 
$ 795 SlOO 
$1295 $170 
S 849 $110 
S 995 $130- 




SYM-1 



5.90 24/5.15 



PET 1BK Large Keyboard 

PET 32K Large Keyboard 

PET8K 

PET 2040 Dual Disk (343K) 

PET 2023 Printer (pres feed) 

PET 2022 Printer (trac feed) 

KIM-1 $159 (Add $30 for Power Supply) 

6500 Programming Manual 

2114 L 450 ns 

2716 EPROM (5 Volt) 
6550 RAM (far 8K PET) 
6502 Microprocessor Chip 
6522 VIA 
6520 PIA 

PET 4 Voice Music Board (MTUK-1002-2) 
Music Software (K-1002-3C) for PET 
Programmers Toolkit - PET ROM Utilities 
Microchess 2.0 for PET or APPLE 
_ PET Word Processor - Machine Language 
1 p 3M "Scotch" 8" disks o « I C 

I = 3iVI "Scotch" 5' diskettes oMLt 
I i Verbatim 5' diskettes 
Cassettes (all tapes guaranteed) 

Premium quality, high output lownoise in 5 screw 
housing with labels: 

C-10 10/5.95 50/25.00 100/48.00 

C-30 10/7.00 50/30.00 100/57.00 

WRITE FOR 6502 AND S-100 PRODUCT LIST 

115-B E. Stump Road 

A B Computers Montgomeryvjlle, PA 18936 

[215] 699-8386 



$222.00 

6.50 

100/4.45 

42.00 

12.70 

9.75 

9.75 

5.50 

$ 49.00 

$ 19.00 

S 45.00 

17.90 

24.00 

10/$31 1 

10/5351 

1 0/527 S 



Pirl Yourself in Control with the 

-^^APPIETHR TTL E 

Thaf s ight! The f^PPlETHROTTLf will turn 
your g; me paddles into a speed controller. 
By Sim oty pushing a button, you can stop 
your C( rtiputer for as long as you want. 
Releas< the button, and your computer 
enters i slow.motion mode with one 
paddle controlling the speed. And if that 
isn't en ough, look at these additional 
feature: :: 

• Plug: i into any slot 

• Wor+s with machine language, Integer 
BASIC, and Applesoft 

• tiorr lal - slow . stop 

• Use :o UST, TTRACE, RUN, etc. 

• NOtOFTWAREtoload _ „ 

• Onveil program secrets ^APPLErHflOrri£ $89.95 

And th< re's more! No more multiple UST commands to view small program 
section: i. With the APPiETHROTTLE, you'll be able to list or trace long 
progran is while watching your program flow in slow-motion. So get in control 
with the APPLE r/VffOrrf.£ and order yours today! 




APPLI!TIME,a Real Time Qock 
for the / pple n. Plugs directly into any 
slot and keeps time even when 
comput:r is off. Features 12/24 
Hour, ECD/ASai data format, and 
AC/Ciy*al time base selection. 
Include; software examples for 
machim: language and BASIC pro- 
grams. Completely assembled and 
tested. 
APT-1 Real Time Clock $79.99 



PROTOBOARD,with over 1300 
holes on 0.1 centers for designing 
your own dn::uits. 
APB-1Proti}boarel .... $17.95 



VERBATIM S'A" DISKETTES 
Soft-Sector Box of 10 . . . $34.90 

(plastic file case included) 




west side electronics 

P.O. Box 636, Chatsworth, CA 9131 1 

We pay all shipping in Connnenra' U S A. 
Others add 1Q°/o. California residents add 6%iax 



t 



eCPUBQBE 



PRESENTS IT'S 

UTILITY PAC II 




CHECKBOOK UPDATE TO DOS 

AN EXEC FILE WRITES OVER YOUR CHECKBOOK 
PROGRAM TO AUTOMATICALLY UPDATE IT TO DOS 

INDEX FILE UPDATE 

AUTOMATES BISHOP'S INDEX FILE 

FIND CONTROL CHARACTER 

WILL DISPLAY CONTROL CHARACTERS ON ANY 
CATALOG OR PROGRAM LISTING 

SLOW LIST 

FULL STOP S START CONTROL WITH EXIT. WORKS 
WITH APPLESOFT OR INTEGER BASIC 

LIST HEADERS 

PUT HEADERS ON YOUR LISTINGS WITH NO LINE 
NUMBERS OR REM STATEMENTS. AP II 

AUTO WRITE 

AUTO WRITE INSTRUCTIONS 

USE EXEC FILES TO APPEND, ADD SUBROUTINES, 
OR EDIT PROGRAMS. CONVERT INTEGER TO APPLE- 
SOFT. DELETE ILLEGAL LINE NUMBERS ETC. ETC. 

EXEC READER 

READS TEXT FILES FOR ABOVE 

DISC SPACE 

COMPLETELY WRITTEN IN APPLESOFT. WORKS 

IN 3 SECONDS. GIVES FREE SECTORS AND BYTES 

WITH LISTINOiS AND DOCUMENTATION/ PRICE $19.95 

DISC MANAGEMENT SYSTEM 

EIGHT PROGRAMS ON DISK TO PROVIDE THE USER WITH A 
COMPLETE UNDERSTANDING OF THE DISK DRIVE COMMANDS 
PLUS A UTILITY PACKAGE TO INDEX 5 CATAGORIZE ALL 
PROGRAMS WRITTEN FOR THE APPLE II COMPUTER. THE 
SYSTEM PROVIDES FULL SEARCH, EDITING AND DATA 
TRANSFER CAPABILITIES. 

A TWENTY-SIX PAGE BOOKLET PROVIDES DETAILED, 
EDUCATIONAL TEQUNIQUES GIVING A THROUGH UNDERSTAND- 
ING OF THE DOS COMMANDS. 

SYSTEM REQUIREMENTS; DISK II S APPLESOFT TAPE OR ROM 
PRICE $19.95. ON DISK FOR EITHER OF ABOVE 

(PROCESSED 5 SHIPPED WITHIN 4 DAYS) 
SEND CHECK OR MONEY ORDER TO: 

SSOFTOUCH 
P.O. BOX 511 
LEOMINSTER, MASS. 01453 




PVINTURE 



GAMES OF HIGH ADVENTURE 
FOR THE APPLE II FROM 

SYNERGISTIC SOFTWARE 

5221 120th Ave. S.E. 
Bellevue, WA 98006 



The ^pventure games combine the exciting graphics and 
sound effects capabilities of the APPLE II with the fas- 
cinaling complexity of a mythical adventure game. 
Mon iters, hazards, obstacles, weapons, magical devices 
and {!vil powers confront the player at every turn as 
you lather treasure and try to reach your goal. Two 
adve itures are now available: 



DUNGEON CAMPAIGN - Full color graphics 
subterranean adventure. 16K required. 
CASS, $12.50 DISK $15.00 

WILDERNESS CAMPAIGN - HIRES graphics 
:.urface adventure. 48K required. 

CASS. $15.00 DISK $17.50 



GET BOTH ON ONE DISK FOR $:10.00 
(WA Res. add 5.3% sales tax) 



A Real-Time Clock for OSM Disk Systems 



Did you know that your OSI disk-based system has most 
of the hardware you need for a realtime clock already 
built in? Here is information on how to use it. 



Robert T. Kintz 

104 Council Rock Avenue 

Rochester, NY 14610 



For most personal and business 
applications, the need for keeping track 
of time is either not very great or can be 
handled by special software routines for 
particular applications. Where micro- 
computers are involved in process con- 
trol operations, however, such as in the 
real-time control of laboratory ex- 
periments, precise timekeeping is a 
must. Here the initiation and sequencing 
of most computer-controlled events 
must be held in tight lock-step with a 
real time clock. 

Owners of Ohio Scientific Challenger 
II and III disk-based systems may not be 
aware that provision for a real-time clock 
already exists on their 470 disk con- 
troller board. The bottom middle section 






1 



270 -TL 
— vw 



of this board contains the PC foils to 
mount three 74390 decade couriter IC's. 
These divide the on-board 1 MHz crystal 
clock to provide pulses ranging from 1 to 
100,000 per second, selectable at the 
user's option. 

Timing pulses may be fed into the NMI 
or IRQ lines of the OSI bus (pins 2 or 3) 
where the 6502 will see them as interrupt 
signals. The software to handle an 
interrupt-driven, time keeping routine 
must have been loaded into memory 
prior to turning the clock on, or It may be 
permanently located in PROM at a con- 
venient memory address. 

One example of how the hardware 
may be implemented is shown in Figure 
1. A 0.1 Hz clock pulse from the third 



■^ NMI 



SW 



< CLOCK 



< PIA-PORT B 
BIT "c/)" 



7 6 5 4 3 2 

74 (^(^ 

8 9 10 II 12 13 14 



+5 



Figure 1 



74390 is fed into both Inputs of a two- 
input nand gate (7400) after passing 
through a switch located on the front 
panel. The 7400 may be conveniently 
located In the prototyping area just 
below the three 74390's on the 470 
board. 

The second Input to the two nand 
gates is taken from bit "0" of a 6821 PIA 
located on the 500 or 510 CPU board. The 
outputs of the two 7400 gates are fed to 
the NMI bus line and a front panel LED, 
respectively. The brightly flashing LED 
serves as a reminder that the clock is 
running, following turning the switch 
"on" and setting bit "0" high. 

The actual interrupt handling and 
clock routines have been written in 
machine language, as shown, where 
they have been assembled to start at 
$6900 (26880). Of course, relocation of 
these routines, as well as the clock 
counters, is entirely optional. Be sure, 
however, that they are located above the 
workspace occupied by BASIC or other 
applications programs. 

A BASIC demonstration program in- 
corporating the clock is also shown. 
Lines 50-70 set up the PIA on the CPU 
board (63232) so that ports A and 8 are 
configured as inputs and outputs, 
respectively. Since OSI's PROM monitor 
vectors to $0130 on receipt of an NMI in- 
terrupt, lines 90-100 POKE a jump to the 
start of the interrupt handling routine. 

Next, in lines 120-140, the machine 
language object code is read as data 
and POKEd into high memory. The 
decimal equivalents of the object code 
are represented as DATA in lines 
9010-9110. Lines 200-220 now set the 
clock counter locations to "0" and we 
are ready to turn the clock switch "ON". 

Once this is accomplished, the clock 
is under program and/or keyboard con- 
trol via POKES to the PIA PORT 8, bit 
"0." Applications programs inserted at 
line 300 may use the clock by PEEKing at 
the appropriate clock counter locations. 



October, 1979 



MICRO -- The 6502 Journal 



17:59 



6957 








HOURS 


» 


$6978 


6957 








MIN 


« 


$6979 


6957 








SECS 


t 


$697A 


6957 








FSEC 


» 


$6978 


5900 










ORG 


$6900 


5900 


48 






START 


PHA 




590 1 


8A 








TXA 




6902 


48 








PHA 




690 3 


98 








TYA 




6904 


48 








PHA 




6905 


20 


OE 


69 




JSR 


CLOCK 


6908 


68 








PLA 




6909 


A8 








TAY 




690A 


68 








PLA 




690B 


AA 








TAX 




690C 


68 








PLA 




690D 


40 








RTI 




690t: 


78 






CLOCK 


SEI 




690F 


F8 








SED 




6910 


18 








CLC 




6911 


AD 


7B 


69 




LDA 


FSEC 


691'4 


69 


01 






ADCIM 


$01 


6916 


8D 


7B 


69 




3TA 


FSEC 


6919 


38 








SEC 




691 A 


E9 


10 






SBCIM 


$0010 


69 1C 


DO 


36 






BNE 


END 


69 IE 


80 


78 


69 




3TA 


FSEC 


6921 


AD 


7A 


69 




LDA 


SECS 


69 2 « 


18 








CLC 




6925 


69 


01 






ADCIM 


$01 


6927 


8D 


7 A 


69 




STA 


SECS 


69 2. 1 


38 








SEC 




692B 


E9 


60 






SBCIM 


$0060 


6920 


DO 


25 






BNE 


END 


692F 


8D 


7A 


69 




STA 


SECS 


6932 


AD 


79 


69 




LDA 


MIN 


6935 


18 








CLC 




6936 


69 


01 






ADCIM 


$01 


6938 


8D 


79 


69 




STA 


MIN 


693B 


38 








SEC 




693C 


E9 


60 






SBCIM 


$0060 


693E 


DO 


14 






BNE 


END 


6940 


8D 


79 


69 




STA 


MIN 


69'*3 


AD 


78 


69 




LDA 


HOURS 


6946 


18 








CLC 




6947 


69 


01 






ADCIM 


$01 


6949 


8D 


78 


69 




STA 


HOURS 


69"C 


38 








SEC 




694D 


E9 


24 






SBCIM 


$2U 


694F 


DO 


3 






BNE 


END 


6951 


8D 


78 


69 




STA 


HOURS 


6954 


D8 






END 


CLD 




6955 


58 








CLI 




6956 


60 








RTS 





10 PRIN':PRINT"REAL-TinE CLOCK FOR DISK-BASED OSI SYSTEHS" 

20 PRIN'sPRINT'ROBERT T. KINTZ, ROCHESTER, NEU YORK" 

30 PRIM':PRINT"RUI*S UNDER OSI OPERATING SYSTEH 0S-iS0,l».3.0" 

40 REN i«« SET UP PIA;PORT A=IMPUT,PORT B^OUTPUT t««4«t*«»«« 

SO X'd3!32:REN PIA ADDRESS OF SOO OR 510 CPU BOARD 

dO POKE Xt|,0:POKE Xt3,0:P0KE X,0 

70 POKE Xt2,2S5:PaKE Xt1,4iP0KE Xt3,4iP0KE Xt2,0 

80 REN «« SET UP CLOCK ROUTINE «>«««««*<**«*«*«:M:>t>4t »»«« 

90 REH INI VECTORS TO 10130(304) 

100 REN «d900(2i8S0)'START OF CLOCK ROUTINE 

no POK 304,7i:P0KE 30S,0:P0KE 30A,10S 

120 REH ••* READ IH HAC CODE AS DATA *«t»*«*t«*«4<«tM««»:<«« 

130 FOR CLK=2iB80 TO 2i9d4 

140 REA NAC;POKE CLK.HACiNEXT CLK 

ISO REN *«* CLOCK COUNTER LOCATIONS «t4:»t«*4««««««»t4«««>»<« 

UO REN «d97S(27000)'HaURS 

170 REN «i979(2700l)=NINUTES 

leo REN «i97A(27002)°SEC0NDS 

190 REN «i97B(27003)°TENTHS 

200 REN *•• POKE RESET INTO COUNTER LOCATIONS ****«»«««««**« 

210 FOR CL°27000 TO 27003 

220 POKI CL.OiNEXT CL 

230 REN ••« TURN THE CLOCK SUITCH TO 'ON' t*«*«*4«««4« >>•«•« 

240 PRII T:PRINT"TURN THE CLOCK SUITCH TO 'ON'..." 

250 PRliTTHEN PRESS 'G' ,'RETURN'":INPUT A« 

240 IF !«<>"G" THEN 250 

270 REN *** POKE START INTO CLOCK GATE «4*«««« >t:>4«44«:M tt m 

280 POKI Xt2,l 

290 PRIITiPRIHT'CLOCK LED SHOULD NOU BE BLINKING" 

300 REN ***************************************************4 

350 REN [ISER'S PROGRAN CAN BE INSERTED HERE 

400 REN TO USE CLOCK, PEEK AT COUNTER LOCATIONS 

500 REN «44*«««««*««««***«««««««««*««4«44*4«4«4«44«4*««-t4*^« 

8999 REI *** NAC CODE DATA FOR CLOCK ROUTINE «««**•>•>•>««>> 

9010 DA1» 72,138,72,152,72,32,14,105 

9020 DAU 104, U8, 104, 170,104,44,120 

9030 DAlt 24, t73, 123, 105,105,1,141, 123 

9040 DA14 105, Si, 233, 10, 208, 54, HI, 123, 105 

9050 DAU 173,122,105,24,105,1,141,122 

90i0 DAU 105, 5i, 233,60,208,37, 141, 122 

9070 DAM 105,173,121,105,24,105,1,141 

9080 DA1« 121, 105, 54, 233, 60,208,20, 141 

9090 OAU 121,105,173,120,105,24,105,1 

9100 DAIt 141,120,105,54,233,24,208,3 

9110 DAU 141,120,105,214,94 

9120 REt »«* TURN 'OFF' THE CLOCK ♦:».*♦. ***..i.*»»**»»»*:m*..m 

9130 POK; Xf2,0 

9140 REl! *''*******a***t*4$*$*$4*********9*-4$4*¥***4*-***-4:4*41t 

9999 ENI 




MOVING ? 

Please notify MICRO of any 
change of address so that you will 
not miss any issues. If we receive 
the Qhange of address informa- 
tion by the 10th of the month, then 
the next issue of MICRO will be 
sent to the new address. We can 
not be responsible for replacing 
issues which are missed due to 
changes of address which you do 
not send in time. The Post Office 
does NOT return the undeliverable 
copies - so we lose both the 
postage and the magazine. 

Send change of address to: 
MICRO 
P.O. Box 6502 
Chelmsford, MA 01824 

Please include old label or your 
subscription number. 



17:60 



MICRO — The 6502 Joi rnal 



October, 1979 



6502 Bibliography: Part XIII 



Dr. William R. Dial 

438 Roslyn Avenue 

Akron, OH 44320 



478. The Cider Press 2 No. 1 (April, 1979) 

Scribblemonger, John, "FORTH, Ver 1.6", pg. 1. 
Forth for the APPLE is 20 times faster than BASIC. 

Silverman, Ken, "Computer Terms", pg. 2. 
APPLE terms defined and explained. 

Nareff, Max J., "Max your APPLE", pg. 2 
Another in a series of articles designed to simulate 
the various MAtriX functions on the APPLE. 

Larsen, Leroy W., "Still another BSTAT", pg. 2. 
This BSTAT offers choice of hex or decimal and gives you 
CATALOG so you can enter the name of the program 
exactly with the cursor and save the program with another 
cursor move on the APPLE. 

Bernard, Phil, "Storing Strings on Tape, or, Is Disk 
Necessary?", pg, 3. 

Anon, "Disk of the Month", pg. 3. 
Twenty-five programs on disk. 

Vrooman, Gerry, "The APPLE II Memory Map De-Fogger", 
pg- 4. 
Explanation of where various functions are in memory. 

Rahl, Robert R., "N-N-N-N-N-N-N-N-N", pg. 6. 
Another version of the Hello program for the APPLE 
disk combining a few new gimmicks. 

479. Byte 4 No 4 (April, 1979) 

Campbell, Richard, "Cross Pollinating the APPLE 11", pgs. 
20-25. 

A serial I/O port based on an Intel 8251 with RS-232 
output. 

Zimmerman, Mark, "Simulating Physical Systems — The 
Two-Dimensional Ideal Gas", pgs. 26-41. 
Use your PET to experiment with physical models. 

Meushaw, Robert V. "The Standard Data Encryption 
Algorithm", pgs. 110-126. 
Using the KIM-1 in encryption. 

480. KB Microcomputing (formerly Kilobaud) No 29 (May, 
1979) 

Lindsay, Len, "PET-Pourri", pgs. 6-7. 

New PET versions of tfie Microtechnology Unlimited 
KIM music board and visible memory are in the offing. 
More on tape head alignment on the PET. A TAPE TEST 
program from Jim Butterfield is listed. 

Anon., "OSI Small Systems Journal", pgs. 8-11 

The OSI Small Systems Journal is now published as a 
section of Microcomputing. 

Anon., "New Products", pgs. 14-25. 
A new control board for PET, An ADC Adapter module 
for PET, and Superchip for the APPLE. 

Knox, Thomas; Brazil, Ray H.; and Richardson, Robert M. 
"Letters to the Editor", dqs. 23-24. 



Letters discuss advantages and disadvantages of APPLE 
II and TRS-80. 

Pepper, Clement S., "KIMCTR", pgs. 34-38, 
Tfiis KIM-1 frequency counter/timer can be used with any 
m cro with comparable features. 

481. Southeastern Software Newsletter No 8 (April 1979) 

McClelland, Geo., "A Fast Circle Drawing Program", pg. 
2, 

On the APPLE Use $FDOC, RDKEY, With several exam- 
pl(JS, a good tutorial. Also explains exclusive OR. 

McClelland, Geo., "Program to Print Applesoft Tokens", 
pg. 4. 

Liiiting of a program to supplement an earlier program to 
print Integer BASIC tokens. 

McC elland, Geo., "Searching for a Small String Embodied 
in a Larger String", pg. 5. 

Simple listing to use with files or data statements, 
etc. 

McClelland, Geo., "Running Disk Programs the Easy Way", 
pg 6. 

Us3 of the cursor makes reading in those program titles 
ea:5y. 

482. 6!i02 User Notes No 14 (April 1979) 

Zube', Jim, "KIM-1 Banner", pgs. 1-9. 
Designed for a 40-column printer. 

Larrabee, Robert D., "Check-Out", pgs. 9-14. 

How to check out a new program on the KIM without 
having to continually hit the plus key. Back up feature. 
And ability to ADD some material in the middle of a pro- 
gram. 

Schilling, Heinz Joachim, "BASIC Mod and Programming 
Hirt", pg 12. 

A modification to correct a problem of reloading 
programs on the KIM using Microsoft BASIC, 

Grabciwsky, Dick, "BASIC Output Paging Mod", pgs 12-13, 
How to limit program listing to 16 lines at a time on the 
KIM using Microsoft BASIC. 

McKenna, Sean, "Automatic Line Number Entry Prompt for 
BASIC", pg 13, 

An automatic line numbering input routine for 9-digit KIM 
BA!51C, 

Herman, Harvey, "Renumber Addendum and Some Mods ', 
pg. 13. 
Hin :s for KIM Microsoft BASIC. 

Grabowsky, Dick, "A New Command for BASIC", pg 15, 
Implementing the GET command in KIM BASIC, 

Anon, "Computer Language Forum", pg, 17, 

Not'is and discussions of FOCAL, Tiny BASIC, FORTH 
and XPLO. 



October, 1979 



MICRO — The 6502 Journal 



17:61 



Mackay, A.M., "Accessing the SYM Displays", pg. 18. 
A program to output ctiaracters on ttie display. 

Kingston, C, "SYM Notes and KIM-4 Compatibility", pg. 18. 
Interfacing details for these two units. 

Adams, Jim, "Wumpus and Music Box for SYM", pg. 20. 
Modifications to implement these two programs on the 
SYM. 

Nelis, Jody, "Manual Corrections", pgs. 20-23. 
Corrections for the AIM User's Manual. 

Merhar, Milan, "TVT-6 Notes and RAM Expansion", pgs. 
24-25. 
TVT-6 discussion and a way to fill the lower 4K In KIM. 

McCormack, Chris, "Cassette Directory Printout Program", 
pgs. 25-26. 
Prints your tape directory on your TTY or terminal. 

483. Stems from Apple 2 No 4 (April, 1979) 

Gustafson, Gus, "INT/FP Stop List Program", pg. 4. 
BASIC programs for Stop List. 

Gustafson, Gus, "Apple Disk Copy Program", pg. 5. 

Modified program to permit using two cards and multiple 
drives. 

Sittel, Randy, "Program FRE(O)", pg. 5. 

Routines for free bytes no matter what the memory. 

484. Circuit News, April 15, 1979 

Anon., "Microcomputers Monitor Oil Well Operation" 
APPLE II is used in monitoring off shore oil well drilling 
processes, displaying information continuously on a silent 700 
printer and an H-P X-Y plotter. 

485. The Pet Gazette, Spring, 1979 

Anon., "Beautiful Music", pg 1, 21. 

Micro Technology Unlimited is coming out with a PET 
version of the KIM music board (DAC) and the visible 
memory. 

Butterfield, Jim, "Routines from PET BASIC", pgs. 2-6. 
A listing of a large number of routines from PET BASIC. 

Anon., "PET Tokens", pg. 8. 
A listing of the 255 PET Tokens. 

Butterfield, Jim, "Thoughts on PET BASIC", pgs. 10-12. 
Hints for PET users, GET statements, the PET timer, 
precautions for amateur mechanics, print suppression, 
etc. 

Sherman, H., "Machine Language Load Program", pg. 14. 
A BASIC program which loads a machine language 
routine into the PET. 

Anon., "Trace", pg. 18. 

A machine language program for tracing the progress of a 
BASIC program. 

Strasma, Jim, "Installing a Second Keyboard", pgs. 20-21. 
Instructions and discussion of the keyboard installation. 

Butterfield, Jim, "Unlist-List Protection", pg. 21. 
How to protect your program listing. 

Albrecht, Bob and" Karl, "PET BASIC for Parents and 
Teachers", pgs. 24-25. 
Part 6 of this continuing tutorial. 

Butterfield, Jim, "PET Memory Locations", pgs. 26-28. 
Listing of a large number of key locations and functions. 

Butterfield, Jim, "Tape Head Alignment", pg 32. 

Procedure and program listing of a tape test to help 
solve this important problem. 

486. Design News, April 23, 1979 

Stefanides, E.J., "Personal Computers Become Tool of the 
Average Man", pgs. 42-48. 



487. B>te4 No5(l\/lay, 1979) 

Pfeif'er, Erich A., "Aids for Hand Assembling Programs", 
pgs. 238-244. 

Th9 article's assembly method is used for program 
de/elopment on a KIM-1 microcomputer. 

488. Southeastern Software Newsletter Issue No 9 (May, 1979) 

ley, Tim, "Stop-List", pg. 1. 



Harti 
St. 

Hart! 
A 
se 
us 

Anor 
Fo 

HartI 
Wr 
mc 
tio 

Anon 
An 
eai 



ip-List which works with Applesoft. 

3y, Tim, and McClelland, Geo., "Character Set", pg. 2. 
Tiachine code program to print the entire character 
. Also a discussion of how the program works and the 
i of the disassembler. 

., "Applesoft II Merge Program", pg. 3. 

■ disk or tape versions or ROM version AS II. 

3y, Tim, "Hl-Res Drawing Program", pgs. 4-5. 

tten for a disk system with the AS II ROM card but 

ds are given to change it for use on other combina- 

is. 

,, "Correcting Disk Files", pgs. 5-7 
addition to the NAMES FILES 
lier issues. 



program given in 



489. MIORO No. 12 (May, 1979) 

Burnf tt, Joe, "An AIM 65 User's Notes", pgs. 5-7. 
No es on getting started with the AIM 65. 

Carptnter, Chuck, "S-C Assembler II — Super APPLE II 
Asiembler", pgs 9-11. 

Ma:hine or assembly language coding is as easy as 
BA 5IC with this assembler. 

Dona o, Joseph, "A PET Hex Dump Program", pgs. 13-15. 
No V you can look at your BASIC in ROM or other 
int( resting codes in macliine language. 

Giery c, Jack, "Super HI-LO for the SYM-1", pgs. 17-22. 
HI- .0 with a new twist to the game. 

Willia-ns, J.C, "A 100 us 16-Channel Analog-to-Digital 
Converter for 65XX Microcomputer Systems", pg. 25-29. 
Ho'i/ real-time games can be written for the OSI 
Chi.llenger systems which use a serial terminal run from 
the ACIA. 

Tripp, Robert M., "ASK the Doctor — Part IV. Good News, 
Bac News", pgs 35-36. 

Gocd news is that only two minor hardware changes 
improve the high-speed cassette read/write. The KIM read 
rou ine is also improved, new uses for the BREAK 
command are given, and now the register name is 
displayed during the R command. 

Rowe Mike (Staff), "The MICRO Software Catalog: VIII", 
pgs 37-38. 
Ele' en new programs are described. 

Doutn^, Ben, "Inside the KIM TTY Service", pgs. 39-40. 
How to operate the KIM TTY link at 9600 baud. 

Kirscfner, Frank D., "The Integer BASIC Token System in 
the APPLE 11", pgs. 41-43. 

Hov APPLE stores characters. A meaty article showing 
how to exercise considerably more control over the BASIC 
interpreter in your microcomputer. 

Carpeiter, Chuck, "Renumber Applesoft", pgs. 45-46. 
Append and renumber routines. 

Anon. "Classified Index for Issues 7 to 12", pgs. 47-48. 
Indf X is broken down by system — APPLE, OSI, General, 
KIM'TIM, SYM/AIM, and so on. 

490. 73 l/lagazine No 12 (May, 1979) 

Schm dt. Bill and Shattuck, Bob, "RTTY Transceive for the 
KIV-1", pgs. 78-82. 

Thi! program requires a video terminal and AFSK genera- 
tor. 



17:62 



MICRO — The 6502 Jounal 



October, 1979 



Introducing SEAWEI.L's 




LitUe Buffered Mother 

The ultimate Motherboard for any KIM-1 , SYM-1 , or AIM-65 system 




Features: 

• 4K Static RAM on board 

• +5V, +12V,and - 12V regulatorson board 
•4+1 buffered expansion slots 

• Accepts KIM-4 compatible boards 

• Full access to application & expansion 
connector 

• LED indicators for IRQ, NMI, and power-on 

• Also compatible with SEA-1 , SEA-16, the 
PROMMER, SEA-PROTO. SEA-ISDC, and more 

For further information contact: 

SEAWELL Marketing Inc. 
P.O. Box 17006 
Seattle, WA 981 07 



• On boo rd hardware for optional use of 
(128Kcddressing limit) 

• Mounts like KIM-4 or with CPU board stand- 
ing up 

• 10 slot Motherboard expansion available - 
SEAWEI.L's Maxi Mother 



Standard $139 

W/4KRAM $189 

Assembled Only 



SEAWELL Marketing Inc. 
315 N.W. 85th 
Seattle, WA 981 17 
(206) 782-9480 



POUVEnSOFT, INC. 

P. O. BOX 157 

PITMAN, NEW JERSEY 08071 

(609) 589-5500 



products for the 

APPLE II 



APPLESOFT II UTILITY 



(Diskette Only) $12.45 



The Applesoft II Utility program provides the user with the following features, a) Complete automatic renumbering of any Applesoft II 
program, b) The creation of an EXEC File for subroutine file creation. This feature allows you to incorporate the same subroutine in various pro- 
grams, c) No modification of the program in machine memory (RAM), d) Automatic running of the program. No programmer should be without 
this excellent utility program. REQUIREMENTS: Disk II. Applesoft II, 16K of memory. 



REAL ESTATE ANALYSIS PROGRAM 



$14.95 



The Real Estate Analysis Program provides the user with three features, a) A powerful real estate investment analysis for buy/sell decisions 
and time to hold decisions for optimal rental/commercial investments, b) Generation of complete amorization schedules consistent with banking 
practices and schedules, c) Generation of depreciation schedules for selecting the best depreciation schedule for your use and a determination of 
optimal switch over points to straight line to maximize depreciation. All three features iire designed for video screen or printer output. In addition, 
the program will plot; cash flow before taxes vs. years, cash flow after taxes vs. years, adjusted basis vs. years, capital gains vs. years, pre-tax pro- 
ceeds vs. years, post-tax proceeds vs. years, and return on investment (%) vs. years. RECUIREMENTS: Applesoft II, 16K of memory without DOS 
or 32K of memory with DOS (Disk II). 



ADDRESS FILE GENERATOR 



$19.95 



A professional piece of software which allows the user to create four different types of address files: a) Holiday File, b) Birthday File, 
c) Home Address File, and d) Commercial Address File. The program contains a menu 3f seven major commands: 1 ) Create a File, 21 Add to File, 
31 Edit File, 4) Display File, 5) Search File, 6) Sort File, and 7) Reorganize File. Most of the major commands have subordinate commands which 
adds to the flexibility of this powerful software system. We doubt you could buy a better program for maintaining and printing address files. 
REQUIREMENTS: Disk II, Apple Printer Card, 32K of memory with Applesoft ROM Card or 48K of memory without Applesoft ROM Card. 

SUPER CHECKBOOK $19.95 

A totally new checkbook program with a unique option . . . Bar Graphs. These bar graphs, outputed to a printer or video screen, provide 
trend analysis data on code expense, income, expenses, or gain/loss on a month by month basis. The program contains a total of fourteen options: 
1 ) Check/Deposit Entry & Modification, 2) Reconciliation of Checks or Deposits, 3) S<irt by Check Number, 4) Sort by Code for Year, 5) Sort by 
Code for Month, 6) Output Year to Date, 7) Output Month Activity, 8-11) Printer/Video Plot Trend Analysis-Bar Graphs, 121 Account Status, 
131 Reconciled Check Status, and 14) Quit. An excellent program for maintaining your :heckbook, or that of a small business. REQUIREMENTS: 
Disk II, 32K of memory with Applesoft ROM Card or 48K of memory without Applesoft ROM Card. 

FUNCTION GRAPHS AND TRANSFORMATIONS 



$14.95 

This program uses the Apple II high resolution graphics capabilities to draw detailed 
graphs of mathematical functions which the user defines in Basic syntax. The graphs appsar in a 
large rectangle whose edges are X and Y scales (with values labeled by up to 6 digits). Graphs 
can be superimposed, erased, drawn as dashed (rather than solid) curves, and transformiid. The 
transformations available are reflection about an axis, stretching or compressing (change of scale), 
and sliding (translation). The user can alternate between the graphic display and a text display 
which lists the available commands and the more recent interactions between user and piogram. 
Expected users are engineers, mathematicians, and researchers in the natural and social sr iences; 
in addition, teachers and students can use the program to approach topics in (for e> ample) 
algebra, trigonometry, and analytic geometry in a visual, intuitive, and experimental wa^ which 
complements the traditional, primarily symbolic orientation. REQUIREMENTS: 16K of 
memory with Applesoft ROM Card or 32K of memory without Applesoft ROM Card. 

Available at your local computet store 



^^••t — •' - 




\ r 
\ / 

— 1— t L. 



-'I tM -I m 11 IH I MM « MM 



Call or write for our free SOFTWARE & ACCE. JSORIES CATALOG 



9 



P /> 



DL 



#: 



c/ d 






DEALER INQUIRIES INVITED 



Apple It is a registered 

trademark of Apple Computer, Inc. 



PaHVERSOFT, INC. 

P.O. BOX 157 

PITMA^, ^EW JERSEY 08071 

(609) 589-5500 



• Check or Money Order 

• Include $1 .00 for 
shipping and handling 

• C.O.D. ($1.00 add'tl. charge) 

• Master Charge and VISA 
orders accep-ted 

• New Jersey residents add 
5% sales tax 

Programs Available ort Diskette 
at $5.00 Additional 



softside 
soitware 

305 Riverside Dr- - " ' .'^..■^- .^^ 

ggt 



305 Riverside Drive New York. N.Y. 10025 




program. 



1 GRAPHICS PAC 2 Quadruple your PET's graphic resolution. Why be 

New Version stuck with the PET's cumbersome 25 x 40 1000 point 

display. With Gi aphics Pac you can directly control 
(set and clear) 4000 points on screen. It's great for grapjiing, plotting, and gaming. Graphics 
Pac allows you to plot in any combination of two modes: I Quadrant graphing with (0,0) center 
screen, and Standard graphing with (0,0) plotted in the u] iper left hand corner. Complete docu- 
mentation shows how you can merge this useful routine vith any of your own programs with- 
out retyping either one! All this on a high quality Mii^rosette for only $9.95. 

2 ASSEMBLER 2001 A full featured assembler for your PET microcompu- 

ter that follows he standard set of 6502 mnemonics. 
Now you can tea^e full advantage of the computing 
abilities of your PET. Store and load via tape, run throu^ h the SYS or USR functions. List and 

edit too with this powerful assembler. No other commerc ial PETassembler gives you all these 
features plus the ability to look at the PET'S secret Basic ROMs all in one program. This valu- 
able program is offered at $15.95 



3 BIKE An exciting new simulation that puts you in 

charge of a bicycle manufacturing empire. Juggle 
inflation, breal^ downs, seasonal sales variations, 
inventory, workers, prices, machines, and ad campa gns to keep your enterprise in the 
black. .Bike is dangerously addictive- Once you start a game you will not want to stop. To 
allow you to take short rest breaks. Bike lets you stoT'! the data from your game on a tape 
so you can continue where you left off next time you vish to play. Worth a million in fun, 
we'll offer BIKE at $9.95. 

4PINBALL Dynamic usag* of the PET's graphics features 

when combined with the fun of the number 1 arcade 
game equals ar action packed video spectacle for 
your computer. Bumpers, chutes, flippers, free balls gates, a jackpot, and a little luck 
guarantee a great game for all. $9 95. 

i^uthors: Our royalties are unbeatable 



-^ 
^ 
^ 
^ 
^ 
^ 
^ 
^ 






-k^^d^r^r^i^ MUSICAL MADDN ESS -jiVTJWV-^r-^r-^r 
SPECIAL add an exciting new dimension to your PET computer 
with Soundware's soundsatior al music box 
and sonicsound software from Soflside & Soundware 



SOUND 



T^ THE SOUNDWORKS i^ 
The Soundware music box for your PET 
comes complete with controllable volume, 
an earphone jack, a demo tape with tivo 
programs, an instruction book, and a one 
year warranty, this sturdy unit is enclosed 
in an attractive plastic case. Notes tell 
how to program your own sound effects. 
All this during our musical madness for 
just 29.95 

WOFiD FUN: Speller: fun ways to practice 
spelling + Scramble + Flashcards 9.95 



■>: MUSICAL SOFTWARE l^ 
ACTIO] vf PACK: Breakthru + Target + 
Catterp liar: non stop graphic action 9.95 
PINBA ^L: a video action spectacle with 
real tin e flippers, chutes gates, bumpers, 

tags et( 9-95 

CLASS CS: Checkers + Backgammon 
Board Piano Player: checkers vs. com- 
puter o:' friend. Piano plays Minute Waltz 

9.95 
MUSIC MANIA: Try to repeat a growing 
sequent e of tones. With graphics. Chal- 
lenge t( ' the best ear 9-95 







Skyles Electric Vforks 



You love your PET, but you'll 
love it more with this BigKeyboard? 



^ 




74KB Big Key Boards® $125.00 (Plus $5.00 shipping & handling) 

The Skyles Big KeyBoard"^. More than 15 inches wide. A layout nearly 
identical to the PET Keyboard and witli all functions — alpha, numeric, 
graphics, special symbols, lower case alpha — on full-sized, almost plump, 
key-tops double-shot to guarantee lifetime durability. 

Actual size 

Would you like to turn on your PET 
. . . and see this 




* * COMMODORE BASIC * * * 
31743 BYTES FREE 
READY 



8KB 8K Memory Expansion Systems @ $250.00 

(Plus $3.50 shipping & handling) 

16KB 16K Memory Expansion Systems @ $450.00 

(Plus $5.00 shipping & handling) 

24KB 24K Memory Expansion Systems @ $650.00 

(Plus $5.00 shipping & handling) 

Skyles Memory Expansion Systems are complete; nothing more to buy, • First quality 
static RAMs • Solid soldered on first quality glass epoxy board • Separate PET Adapter 
Printed Circuit Board connects directly to data bus on your PET — no rat's nest of hang- 
ing hand-wiring • Ribbon cable and 50 pin connectors that keep your PET open to the 
outside world (one on the 8KB; two on the 16KB and 24KB). 

8KB Memory Expansion System(s) at S250 each. $ 

(Adds 8,192 bytes; total 1 5 ,3 59){shipping and handling $3.50 each) 

16KB Memor>' Expansion System(s) at $450 each. S 

(Adds 16,384 bytes; total 23,551) (shipping and handling $5.00 each) 

24KB Memory Expansion System(s) at $650 each. $ 

(Adds 14,576 bytes; total 31 ,743) (shipping and handling $7.00 each) 

74KB Big Key Board (s) at S125 $ 

(shipping and handling $5.00 each) 

SPECIAL l)EAL(S): 8KB Memory and 74KB KeyBoard at $350 complete $ 

SPECIAL DEAL(S): 16KB Memory and 74KB KeyBoard at $525 complete $ 

* Please add 6% sales tax if you are a California resident; 6.5% if a resident of BART, Santa Clara or Santa Cruz Counties (CA). 
Please add shipping and handling costs as indicated. 

VISA, MASTERCHARGE ORDERS CALL (800) 227-8398 (except California residents) 

CALIFORNIA ORDERS PLEASE CALL (415) 494-1210 




Skyles Electric Works 



10301 Stonydale Drive 
Cupertino, CA 95014 
(408) 735-7891